mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 23:49:12 +00:00
Renamed driverdata to internal
This was done to SDL_DisplayMode for consistency with SDL_Surface and gives it a type so we don't have to do casts in SDL code. I considered switching to an ID and hashing the driver data, etc. but all of that involved a lot of internal code churn and this solution gives us flexibility in how we handle this in the future. After consideration, I made this renaming global across the project, for consistency. Fixes https://github.com/libsdl-org/SDL/issues/10198
This commit is contained in:
parent
fe183872ee
commit
9ca1792848
138 changed files with 1454 additions and 1456 deletions
|
@ -74,6 +74,9 @@ typedef enum SDL_SystemTheme
|
||||||
SDL_SYSTEM_THEME_DARK /**< Dark colored system theme */
|
SDL_SYSTEM_THEME_DARK /**< Dark colored system theme */
|
||||||
} SDL_SystemTheme;
|
} SDL_SystemTheme;
|
||||||
|
|
||||||
|
/* Internal display mode data */
|
||||||
|
typedef struct SDL_DisplayModeData SDL_DisplayModeData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The structure that defines a display mode.
|
* The structure that defines a display mode.
|
||||||
*
|
*
|
||||||
|
@ -95,7 +98,9 @@ typedef struct SDL_DisplayMode
|
||||||
float refresh_rate; /**< refresh rate (or 0.0f for unspecified) */
|
float refresh_rate; /**< refresh rate (or 0.0f for unspecified) */
|
||||||
int refresh_rate_numerator; /**< precise refresh rate numerator (or 0 for unspecified) */
|
int refresh_rate_numerator; /**< precise refresh rate numerator (or 0 for unspecified) */
|
||||||
int refresh_rate_denominator; /**< precise refresh rate denominator */
|
int refresh_rate_denominator; /**< precise refresh rate denominator */
|
||||||
void *driverdata; /**< driver-specific data, initialize to 0 */
|
|
||||||
|
SDL_DisplayModeData *internal; /**< Private */
|
||||||
|
|
||||||
} SDL_DisplayMode;
|
} SDL_DisplayMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, j
|
||||||
SDL_LockMutex(Android_ActivityMutex);
|
SDL_LockMutex(Android_ActivityMutex);
|
||||||
|
|
||||||
if (Android_Window) {
|
if (Android_Window) {
|
||||||
SDL_WindowData *data = Android_Window->driverdata;
|
SDL_WindowData *data = Android_Window->internal;
|
||||||
|
|
||||||
data->native_window = Android_JNI_GetNativeWindow();
|
data->native_window = Android_JNI_GetNativeWindow();
|
||||||
if (data->native_window == NULL) {
|
if (data->native_window == NULL) {
|
||||||
|
@ -1163,7 +1163,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j
|
||||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||||
if (Android_Window) {
|
if (Android_Window) {
|
||||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||||
SDL_WindowData *data = Android_Window->driverdata;
|
SDL_WindowData *data = Android_Window->internal;
|
||||||
|
|
||||||
/* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */
|
/* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */
|
||||||
if (data->egl_surface == EGL_NO_SURFACE) {
|
if (data->egl_surface == EGL_NO_SURFACE) {
|
||||||
|
@ -1187,7 +1187,7 @@ retry:
|
||||||
SDL_LockMutex(Android_ActivityMutex);
|
SDL_LockMutex(Android_ActivityMutex);
|
||||||
|
|
||||||
if (Android_Window) {
|
if (Android_Window) {
|
||||||
SDL_WindowData *data = Android_Window->driverdata;
|
SDL_WindowData *data = Android_Window->internal;
|
||||||
|
|
||||||
/* Wait for Main thread being paused and context un-activated to release 'egl_surface' */
|
/* Wait for Main thread being paused and context un-activated to release 'egl_surface' */
|
||||||
if (!data->backup_done) {
|
if (!data->backup_done) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
|
||||||
if (coreWindow) {
|
if (coreWindow) {
|
||||||
if (WINRT_GlobalSDLWindow) {
|
if (WINRT_GlobalSDLWindow) {
|
||||||
SDL_Window *window = WINRT_GlobalSDLWindow;
|
SDL_Window *window = WINRT_GlobalSDLWindow;
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
|
|
||||||
int x = (int)SDL_lroundf(data->coreWindow->Bounds.Left);
|
int x = (int)SDL_lroundf(data->coreWindow->Bounds.Left);
|
||||||
int y = (int)SDL_lroundf(data->coreWindow->Bounds.Top);
|
int y = (int)SDL_lroundf(data->coreWindow->Bounds.Top);
|
||||||
|
@ -228,7 +228,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender)
|
||||||
// TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases
|
// TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases
|
||||||
SDL_Window *window = WINRT_GlobalSDLWindow;
|
SDL_Window *window = WINRT_GlobalSDLWindow;
|
||||||
if (window) {
|
if (window) {
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
int w = (int)SDL_floorf(data->coreWindow->Bounds.Width);
|
int w = (int)SDL_floorf(data->coreWindow->Bounds.Width);
|
||||||
int h = (int)SDL_floorf(data->coreWindow->Bounds.Height);
|
int h = (int)SDL_floorf(data->coreWindow->Bounds.Height);
|
||||||
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESIZED, w, h);
|
SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESIZED, w, h);
|
||||||
|
|
|
@ -409,7 +409,7 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse->FreeCursor && default_cursor->driverdata) {
|
if (mouse->FreeCursor && default_cursor->internal) {
|
||||||
mouse->FreeCursor(default_cursor);
|
mouse->FreeCursor(default_cursor);
|
||||||
} else {
|
} else {
|
||||||
SDL_free(default_cursor);
|
SDL_free(default_cursor);
|
||||||
|
@ -1628,7 +1628,7 @@ void SDL_DestroyCursor(SDL_Cursor *cursor)
|
||||||
mouse->cursors = curr->next;
|
mouse->cursors = curr->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouse->FreeCursor && curr->driverdata) {
|
if (mouse->FreeCursor && curr->internal) {
|
||||||
mouse->FreeCursor(curr);
|
mouse->FreeCursor(curr);
|
||||||
} else {
|
} else {
|
||||||
SDL_free(curr);
|
SDL_free(curr);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
struct SDL_Cursor
|
struct SDL_Cursor
|
||||||
{
|
{
|
||||||
struct SDL_Cursor *next;
|
struct SDL_Cursor *next;
|
||||||
void *driverdata;
|
void *internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -126,7 +126,7 @@ typedef struct
|
||||||
SDL_bool cursor_shown;
|
SDL_bool cursor_shown;
|
||||||
|
|
||||||
/* Driver-dependent data. */
|
/* Driver-dependent data. */
|
||||||
void *driverdata;
|
void *internal;
|
||||||
} SDL_Mouse;
|
} SDL_Mouse;
|
||||||
|
|
||||||
/* Initialize the mouse subsystem, called before the main video driver is initialized */
|
/* Initialize the mouse subsystem, called before the main video driver is initialized */
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct SDL_Texture
|
||||||
|
|
||||||
SDL_PropertiesID props;
|
SDL_PropertiesID props;
|
||||||
|
|
||||||
void *driverdata; /**< Driver specific texture representation */
|
void *internal; /**< Driver specific texture representation */
|
||||||
|
|
||||||
SDL_Texture *prev;
|
SDL_Texture *prev;
|
||||||
SDL_Texture *next;
|
SDL_Texture *next;
|
||||||
|
@ -290,7 +290,7 @@ struct SDL_Renderer
|
||||||
|
|
||||||
SDL_bool destroyed; // already destroyed by SDL_DestroyWindow; just free this struct in SDL_DestroyRenderer.
|
SDL_bool destroyed; // already destroyed by SDL_DestroyWindow; just free this struct in SDL_DestroyRenderer.
|
||||||
|
|
||||||
void *driverdata;
|
void *internal;
|
||||||
|
|
||||||
SDL_Renderer *next;
|
SDL_Renderer *next;
|
||||||
};
|
};
|
||||||
|
|
|
@ -285,7 +285,7 @@ static int D3D_Reset(SDL_Renderer *renderer);
|
||||||
|
|
||||||
static int D3D_ActivateRenderer(SDL_Renderer *renderer)
|
static int D3D_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
if (data->updateSize) {
|
if (data->updateSize) {
|
||||||
|
@ -332,7 +332,7 @@ static int D3D_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
static void D3D_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
||||||
data->updateSize = SDL_TRUE;
|
data->updateSize = SDL_TRUE;
|
||||||
|
@ -389,7 +389,7 @@ static D3DBLENDOP GetBlendEquation(SDL_BlendOperation operation)
|
||||||
|
|
||||||
static SDL_bool D3D_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
static SDL_bool D3D_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
|
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
|
||||||
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
|
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
|
||||||
SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
|
SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
|
||||||
|
@ -523,7 +523,7 @@ static void D3D_DestroyTextureRep(D3D_TextureRep *texture)
|
||||||
|
|
||||||
static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata;
|
D3D_TextureData *texturedata;
|
||||||
DWORD usage;
|
DWORD usage;
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||||
}
|
}
|
||||||
texturedata->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
texturedata->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||||
|
|
||||||
texture->driverdata = texturedata;
|
texture->internal = texturedata;
|
||||||
|
|
||||||
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
||||||
usage = D3DUSAGE_RENDERTARGET;
|
usage = D3DUSAGE_RENDERTARGET;
|
||||||
|
@ -569,8 +569,8 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||||
|
|
||||||
static int D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -596,8 +596,8 @@ static int D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
static int D3D_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int D3D_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *pixels, int pitch)
|
const SDL_Rect *rect, const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -632,8 +632,8 @@ static int D3D_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Uplane, int Upitch,
|
const Uint8 *Uplane, int Upitch,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -655,8 +655,8 @@ static int D3D_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int D3D_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int D3D_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
IDirect3DDevice9 *device = data->device;
|
IDirect3DDevice9 *device = data->device;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
|
@ -706,8 +706,8 @@ static int D3D_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void D3D_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void D3D_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return;
|
return;
|
||||||
|
@ -736,7 +736,7 @@ static void D3D_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return;
|
return;
|
||||||
|
@ -747,7 +747,7 @@ static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture
|
||||||
|
|
||||||
static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *texturedata;
|
D3D_TextureData *texturedata;
|
||||||
D3D_TextureRep *texturerep;
|
D3D_TextureRep *texturerep;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
@ -764,7 +764,7 @@ static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *text
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
texturedata = (D3D_TextureData *)texture->driverdata;
|
texturedata = (D3D_TextureData *)texture->internal;
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
}
|
}
|
||||||
|
@ -941,7 +941,7 @@ static void UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *textur
|
||||||
|
|
||||||
static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, D3D9_Shader *shader, const float **shader_params)
|
static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, D3D9_Shader *shader, const float **shader_params)
|
||||||
{
|
{
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!texturedata) {
|
if (!texturedata) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -978,8 +978,8 @@ static int SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
if (texture != data->drawstate.texture) {
|
if (texture != data->drawstate.texture) {
|
||||||
#if SDL_HAVE_YUV
|
#if SDL_HAVE_YUV
|
||||||
D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *)data->drawstate.texture->driverdata : NULL;
|
D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *)data->drawstate.texture->internal : NULL;
|
||||||
D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *)texture->driverdata : NULL;
|
D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *)texture->internal : NULL;
|
||||||
#endif
|
#endif
|
||||||
D3D9_Shader shader = SHADER_NONE;
|
D3D9_Shader shader = SHADER_NONE;
|
||||||
const float *shader_params = NULL;
|
const float *shader_params = NULL;
|
||||||
|
@ -1021,7 +1021,7 @@ static int SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
data->drawstate.texture = texture;
|
data->drawstate.texture = texture;
|
||||||
} else if (texture) {
|
} else if (texture) {
|
||||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal;
|
||||||
UpdateDirtyTexture(data->device, &texturedata->texture);
|
UpdateDirtyTexture(data->device, &texturedata->texture);
|
||||||
#if SDL_HAVE_YUV
|
#if SDL_HAVE_YUV
|
||||||
if (texturedata->yuv) {
|
if (texturedata->yuv) {
|
||||||
|
@ -1104,7 +1104,7 @@ static int SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
static void D3D_InvalidateCachedState(SDL_Renderer *renderer)
|
static void D3D_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||||
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
||||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||||
|
@ -1116,7 +1116,7 @@ static void D3D_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int D3D_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
const int vboidx = data->currentVertexBuffer;
|
const int vboidx = data->currentVertexBuffer;
|
||||||
IDirect3DVertexBuffer9 *vbo = NULL;
|
IDirect3DVertexBuffer9 *vbo = NULL;
|
||||||
const SDL_bool istarget = renderer->target != NULL;
|
const SDL_bool istarget = renderer->target != NULL;
|
||||||
|
@ -1315,7 +1315,7 @@ static int D3D_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
||||||
|
|
||||||
static SDL_Surface *D3D_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *D3D_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
D3DSURFACE_DESC desc;
|
D3DSURFACE_DESC desc;
|
||||||
LPDIRECT3DSURFACE9 backBuffer;
|
LPDIRECT3DSURFACE9 backBuffer;
|
||||||
LPDIRECT3DSURFACE9 surface;
|
LPDIRECT3DSURFACE9 surface;
|
||||||
|
@ -1372,7 +1372,7 @@ static SDL_Surface *D3D_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
|
||||||
|
|
||||||
static int D3D_RenderPresent(SDL_Renderer *renderer)
|
static int D3D_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
if (!data->beginScene) {
|
if (!data->beginScene) {
|
||||||
|
@ -1397,8 +1397,8 @@ static int D3D_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void D3D_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D_RenderData *renderdata = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *renderdata = (D3D_RenderData *)renderer->internal;
|
||||||
D3D_TextureData *data = (D3D_TextureData *)texture->driverdata;
|
D3D_TextureData *data = (D3D_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (renderdata->drawstate.texture == texture) {
|
if (renderdata->drawstate.texture == texture) {
|
||||||
renderdata->drawstate.texture = NULL;
|
renderdata->drawstate.texture = NULL;
|
||||||
|
@ -1425,12 +1425,12 @@ static void D3D_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
SDL_free(data->pixels);
|
SDL_free(data->pixels);
|
||||||
#endif
|
#endif
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void D3D_DestroyRenderer(SDL_Renderer *renderer)
|
static void D3D_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -1473,7 +1473,7 @@ static void D3D_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D_Reset(SDL_Renderer *renderer)
|
static int D3D_Reset(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
const Float4X4 d3dmatrix = MatrixIdentity();
|
const Float4X4 d3dmatrix = MatrixIdentity();
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
SDL_Texture *texture;
|
SDL_Texture *texture;
|
||||||
|
@ -1551,7 +1551,7 @@ static int D3D_Reset(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int D3D_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
D3D_RenderData *data = (D3D_RenderData *)renderer->internal;
|
||||||
|
|
||||||
DWORD PresentationInterval;
|
DWORD PresentationInterval;
|
||||||
switch (vsync) {
|
switch (vsync) {
|
||||||
|
@ -1648,7 +1648,7 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie
|
||||||
renderer->DestroyTexture = D3D_DestroyTexture;
|
renderer->DestroyTexture = D3D_DestroyTexture;
|
||||||
renderer->DestroyRenderer = D3D_DestroyRenderer;
|
renderer->DestroyRenderer = D3D_DestroyRenderer;
|
||||||
renderer->SetVSync = D3D_SetVSync;
|
renderer->SetVSync = D3D_SetVSync;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
D3D_InvalidateCachedState(renderer);
|
D3D_InvalidateCachedState(renderer);
|
||||||
|
|
||||||
renderer->name = D3D_RenderDriver.name;
|
renderer->name = D3D_RenderDriver.name;
|
||||||
|
|
|
@ -325,7 +325,7 @@ static void D3D11_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture);
|
||||||
|
|
||||||
static void D3D11_ReleaseAll(SDL_Renderer *renderer)
|
static void D3D11_ReleaseAll(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
SDL_Texture *texture = NULL;
|
SDL_Texture *texture = NULL;
|
||||||
|
|
||||||
/* Release all textures */
|
/* Release all textures */
|
||||||
|
@ -410,7 +410,7 @@ static void D3D11_ReleaseAll(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D11_DestroyRenderer(SDL_Renderer *renderer)
|
static void D3D11_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_ReleaseAll(renderer);
|
D3D11_ReleaseAll(renderer);
|
||||||
if (data) {
|
if (data) {
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
|
@ -465,7 +465,7 @@ static D3D11_BLEND_OP GetBlendEquation(SDL_BlendOperation operation)
|
||||||
|
|
||||||
static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
|
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
|
||||||
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
|
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
|
||||||
SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
|
SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
|
||||||
|
@ -514,7 +514,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
|
||||||
typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY2)(UINT flags, REFIID riid, void **ppFactory);
|
typedef HRESULT(WINAPI * PFN_CREATE_DXGI_FACTORY2)(UINT flags, REFIID riid, void **ppFactory);
|
||||||
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc = NULL;
|
PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc = NULL;
|
||||||
PFN_CREATE_DXGI_FACTORY2 CreateDXGIFactory2Func = NULL;
|
PFN_CREATE_DXGI_FACTORY2 CreateDXGIFactory2Func = NULL;
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
|
PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
|
||||||
ID3D11Device *d3dDevice = NULL;
|
ID3D11Device *d3dDevice = NULL;
|
||||||
ID3D11DeviceContext *d3dContext = NULL;
|
ID3D11DeviceContext *d3dContext = NULL;
|
||||||
|
@ -829,7 +829,7 @@ static BOOL D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation)
|
||||||
|
|
||||||
static int D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer *renderer)
|
static int D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
if (data->currentOffscreenRenderTargetView) {
|
if (data->currentOffscreenRenderTargetView) {
|
||||||
return DXGI_MODE_ROTATION_IDENTITY;
|
return DXGI_MODE_ROTATION_IDENTITY;
|
||||||
} else {
|
} else {
|
||||||
|
@ -839,7 +839,7 @@ static int D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D11_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rect *sdlRect, D3D11_RECT *outRect, BOOL includeViewportOffset)
|
static int D3D11_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rect *sdlRect, D3D11_RECT *outRect, BOOL includeViewportOffset)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
|
const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
|
||||||
const SDL_Rect *viewport = &data->currentViewport;
|
const SDL_Rect *viewport = &data->currentViewport;
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ static int D3D11_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rec
|
||||||
|
|
||||||
static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
#ifdef SDL_PLATFORM_WINRT
|
#ifdef SDL_PLATFORM_WINRT
|
||||||
IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
|
IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
|
||||||
const BOOL usingXAML = (!coreWindow);
|
const BOOL usingXAML = (!coreWindow);
|
||||||
|
@ -1038,7 +1038,7 @@ done:
|
||||||
|
|
||||||
static void D3D11_ReleaseMainRenderTargetView(SDL_Renderer *renderer)
|
static void D3D11_ReleaseMainRenderTargetView(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
ID3D11DeviceContext_OMSetRenderTargets(data->d3dContext, 0, NULL, NULL);
|
ID3D11DeviceContext_OMSetRenderTargets(data->d3dContext, 0, NULL, NULL);
|
||||||
SAFE_RELEASE(data->mainRenderTargetView);
|
SAFE_RELEASE(data->mainRenderTargetView);
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ static HRESULT D3D11_HandleDeviceLost(SDL_Renderer *renderer)
|
||||||
/* Initialize all resources that change when the window's size changes. */
|
/* Initialize all resources that change when the window's size changes. */
|
||||||
static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
ID3D11Texture2D *backBuffer = NULL;
|
ID3D11Texture2D *backBuffer = NULL;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -1203,7 +1203,7 @@ void D3D11_Trim(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
#ifdef SDL_PLATFORM_WINRT
|
#ifdef SDL_PLATFORM_WINRT
|
||||||
#if NTDDI_VERSION > NTDDI_WIN8
|
#if NTDDI_VERSION > NTDDI_WIN8
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
IDXGIDevice3 *dxgiDevice = NULL;
|
IDXGIDevice3 *dxgiDevice = NULL;
|
||||||
|
|
||||||
|
@ -1221,7 +1221,7 @@ void D3D11_Trim(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D11_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
static void D3D11_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
||||||
data->pixelSizeChanged = SDL_TRUE;
|
data->pixelSizeChanged = SDL_TRUE;
|
||||||
|
@ -1260,7 +1260,7 @@ static int GetTextureProperty(SDL_PropertiesID props, const char *name, ID3D11Te
|
||||||
|
|
||||||
static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData;
|
D3D11_TextureData *textureData;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DXGI_FORMAT textureFormat = SDLPixelFormatToDXGITextureFormat(texture->format, renderer->output_colorspace);
|
DXGI_FORMAT textureFormat = SDLPixelFormatToDXGITextureFormat(texture->format, renderer->output_colorspace);
|
||||||
|
@ -1278,7 +1278,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
}
|
}
|
||||||
textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||||
|
|
||||||
texture->driverdata = textureData;
|
texture->internal = textureData;
|
||||||
|
|
||||||
SDL_zero(textureDesc);
|
SDL_zero(textureDesc);
|
||||||
textureDesc.Width = texture->w;
|
textureDesc.Width = texture->w;
|
||||||
|
@ -1465,7 +1465,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
static void D3D11_DestroyTexture(SDL_Renderer *renderer,
|
static void D3D11_DestroyTexture(SDL_Renderer *renderer,
|
||||||
SDL_Texture *texture)
|
SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D11_TextureData *data = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *data = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
|
@ -1484,7 +1484,7 @@ static void D3D11_DestroyTexture(SDL_Renderer *renderer,
|
||||||
SDL_free(data->pixels);
|
SDL_free(data->pixels);
|
||||||
#endif
|
#endif
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch)
|
static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch)
|
||||||
|
@ -1607,8 +1607,8 @@ static int D3D11_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *srcPixels,
|
const SDL_Rect *rect, const void *srcPixels,
|
||||||
int srcPitch)
|
int srcPitch)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -1649,8 +1649,8 @@ static int D3D11_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Uplane, int Upitch,
|
const Uint8 *Uplane, int Upitch,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -1673,8 +1673,8 @@ static int D3D11_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Yplane, int Ypitch,
|
const Uint8 *Yplane, int Ypitch,
|
||||||
const Uint8 *UVplane, int UVpitch)
|
const Uint8 *UVplane, int UVpitch)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
ID3D11Texture2D *stagingTexture;
|
ID3D11Texture2D *stagingTexture;
|
||||||
const Uint8 *src;
|
const Uint8 *src;
|
||||||
Uint8 *dst;
|
Uint8 *dst;
|
||||||
|
@ -1785,8 +1785,8 @@ static int D3D11_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int D3D11_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int D3D11_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
D3D11_TEXTURE2D_DESC stagingTextureDesc;
|
D3D11_TEXTURE2D_DESC stagingTextureDesc;
|
||||||
D3D11_MAPPED_SUBRESOURCE textureMemory;
|
D3D11_MAPPED_SUBRESOURCE textureMemory;
|
||||||
|
@ -1867,8 +1867,8 @@ static int D3D11_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void D3D11_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void D3D11_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -1904,7 +1904,7 @@ static void D3D11_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -1915,7 +1915,7 @@ static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||||
|
|
||||||
static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = NULL;
|
D3D11_TextureData *textureData = NULL;
|
||||||
|
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
|
@ -1923,7 +1923,7 @@ static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
textureData = (D3D11_TextureData *)texture->driverdata;
|
textureData = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData->mainTextureRenderTargetView) {
|
if (!textureData->mainTextureRenderTargetView) {
|
||||||
return SDL_SetError("specified texture is not a render target");
|
return SDL_SetError("specified texture is not a render target");
|
||||||
|
@ -1977,7 +1977,7 @@ static int D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||||
int count = indices ? num_indices : num_vertices;
|
int count = indices ? num_indices : num_vertices;
|
||||||
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
||||||
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
|
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
|
||||||
D3D11_TextureData *textureData = texture ? (D3D11_TextureData *)texture->driverdata : NULL;
|
D3D11_TextureData *textureData = texture ? (D3D11_TextureData *)texture->internal : NULL;
|
||||||
float u_scale = textureData ? (float)texture->w / textureData->w : 0.0f;
|
float u_scale = textureData ? (float)texture->w / textureData->w : 0.0f;
|
||||||
float v_scale = textureData ? (float)texture->h / textureData->h : 0.0f;
|
float v_scale = textureData ? (float)texture->h / textureData->h : 0.0f;
|
||||||
|
|
||||||
|
@ -2027,7 +2027,7 @@ static int D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||||
static int D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
|
static int D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
const void *vertexData, size_t dataSizeInBytes)
|
const void *vertexData, size_t dataSizeInBytes)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
const int vbidx = rendererData->currentVertexBuffer;
|
const int vbidx = rendererData->currentVertexBuffer;
|
||||||
const UINT stride = sizeof(VertexPositionColor);
|
const UINT stride = sizeof(VertexPositionColor);
|
||||||
|
@ -2095,7 +2095,7 @@ static int D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
|
|
||||||
static int D3D11_UpdateViewport(SDL_Renderer *renderer)
|
static int D3D11_UpdateViewport(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
const SDL_Rect *viewport = &data->currentViewport;
|
const SDL_Rect *viewport = &data->currentViewport;
|
||||||
Float4X4 projection;
|
Float4X4 projection;
|
||||||
Float4X4 view;
|
Float4X4 view;
|
||||||
|
@ -2187,7 +2187,7 @@ static int D3D11_UpdateViewport(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static ID3D11RenderTargetView *D3D11_GetCurrentRenderTargetView(SDL_Renderer *renderer)
|
static ID3D11RenderTargetView *D3D11_GetCurrentRenderTargetView(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
if (data->currentOffscreenRenderTargetView) {
|
if (data->currentOffscreenRenderTargetView) {
|
||||||
return data->currentOffscreenRenderTargetView;
|
return data->currentOffscreenRenderTargetView;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2205,7 +2205,7 @@ static void D3D11_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderC
|
||||||
constants->color_scale = cmd->data.draw.color_scale;
|
constants->color_scale = cmd->data.draw.color_scale;
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
|
|
||||||
switch (texture->format) {
|
switch (texture->format) {
|
||||||
case SDL_PIXELFORMAT_YV12:
|
case SDL_PIXELFORMAT_YV12:
|
||||||
|
@ -2263,7 +2263,7 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||||
ID3D11SamplerState *sampler, const Float4X4 *matrix)
|
ID3D11SamplerState *sampler, const Float4X4 *matrix)
|
||||||
|
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity;
|
const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity;
|
||||||
ID3D11RasterizerState *rasterizerState;
|
ID3D11RasterizerState *rasterizerState;
|
||||||
ID3D11RenderTargetView *renderTargetView = D3D11_GetCurrentRenderTargetView(renderer);
|
ID3D11RenderTargetView *renderTargetView = D3D11_GetCurrentRenderTargetView(renderer);
|
||||||
|
@ -2413,8 +2413,8 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||||
static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix)
|
static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix)
|
||||||
{
|
{
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal;
|
||||||
ID3D11SamplerState *textureSampler;
|
ID3D11SamplerState *textureSampler;
|
||||||
PixelShaderConstants constants;
|
PixelShaderConstants constants;
|
||||||
|
|
||||||
|
@ -2461,14 +2461,14 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||||
|
|
||||||
static void D3D11_DrawPrimitives(SDL_Renderer *renderer, D3D11_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
static void D3D11_DrawPrimitives(SDL_Renderer *renderer, D3D11_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, primitiveTopology);
|
ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, primitiveTopology);
|
||||||
ID3D11DeviceContext_Draw(rendererData->d3dContext, (UINT)vertexCount, (UINT)vertexStart);
|
ID3D11DeviceContext_Draw(rendererData->d3dContext, (UINT)vertexCount, (UINT)vertexStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void D3D11_InvalidateCachedState(SDL_Renderer *renderer)
|
static void D3D11_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
data->currentRenderTargetView = NULL;
|
data->currentRenderTargetView = NULL;
|
||||||
data->currentRasterizerState = NULL;
|
data->currentRasterizerState = NULL;
|
||||||
data->currentBlendState = NULL;
|
data->currentBlendState = NULL;
|
||||||
|
@ -2481,7 +2481,7 @@ static void D3D11_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal;
|
||||||
const int viewportRotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
|
const int viewportRotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
|
||||||
|
|
||||||
if (rendererData->pixelSizeChanged) {
|
if (rendererData->pixelSizeChanged) {
|
||||||
|
@ -2606,7 +2606,7 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||||
|
|
||||||
static SDL_Surface *D3D11_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *D3D11_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
ID3D11RenderTargetView *renderTargetView = NULL;
|
ID3D11RenderTargetView *renderTargetView = NULL;
|
||||||
ID3D11Texture2D *backBuffer = NULL;
|
ID3D11Texture2D *backBuffer = NULL;
|
||||||
ID3D11Texture2D *stagingTexture = NULL;
|
ID3D11Texture2D *stagingTexture = NULL;
|
||||||
|
@ -2698,7 +2698,7 @@ done:
|
||||||
|
|
||||||
static int D3D11_RenderPresent(SDL_Renderer *renderer)
|
static int D3D11_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DXGI_PRESENT_PARAMETERS parameters;
|
DXGI_PRESENT_PARAMETERS parameters;
|
||||||
|
|
||||||
|
@ -2744,7 +2744,7 @@ static int D3D11_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D11_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int D3D11_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
D3D11_RenderData *data = (D3D11_RenderData *)renderer->internal;
|
||||||
|
|
||||||
#if SDL_WINAPI_FAMILY_PHONE
|
#if SDL_WINAPI_FAMILY_PHONE
|
||||||
/* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1.
|
/* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1.
|
||||||
|
@ -2824,7 +2824,7 @@ static int D3D11_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_
|
||||||
renderer->DestroyTexture = D3D11_DestroyTexture;
|
renderer->DestroyTexture = D3D11_DestroyTexture;
|
||||||
renderer->DestroyRenderer = D3D11_DestroyRenderer;
|
renderer->DestroyRenderer = D3D11_DestroyRenderer;
|
||||||
renderer->SetVSync = D3D11_SetVSync;
|
renderer->SetVSync = D3D11_SetVSync;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
D3D11_InvalidateCachedState(renderer);
|
D3D11_InvalidateCachedState(renderer);
|
||||||
|
|
||||||
renderer->name = D3D11_RenderDriver.name;
|
renderer->name = D3D11_RenderDriver.name;
|
||||||
|
|
|
@ -442,7 +442,7 @@ static void D3D12_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture);
|
||||||
|
|
||||||
static void D3D12_ReleaseAll(SDL_Renderer *renderer)
|
static void D3D12_ReleaseAll(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
SDL_Texture *texture = NULL;
|
SDL_Texture *texture = NULL;
|
||||||
|
|
||||||
SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
|
SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
|
||||||
|
@ -556,7 +556,7 @@ static void D3D12_WaitForGPU(D3D12_RenderData *data)
|
||||||
|
|
||||||
static D3D12_CPU_DESCRIPTOR_HANDLE D3D12_GetCurrentRenderTargetView(SDL_Renderer *renderer)
|
static D3D12_CPU_DESCRIPTOR_HANDLE D3D12_GetCurrentRenderTargetView(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor;
|
D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor;
|
||||||
|
|
||||||
if (data->textureRenderTarget) {
|
if (data->textureRenderTarget) {
|
||||||
|
@ -634,7 +634,7 @@ static int D3D12_IssueBatch(D3D12_RenderData *data)
|
||||||
|
|
||||||
static void D3D12_DestroyRenderer(SDL_Renderer *renderer)
|
static void D3D12_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_WaitForGPU(data);
|
D3D12_WaitForGPU(data);
|
||||||
D3D12_ReleaseAll(renderer);
|
D3D12_ReleaseAll(renderer);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -721,7 +721,7 @@ static D3D12_PipelineState *D3D12_CreatePipelineState(SDL_Renderer *renderer,
|
||||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
|
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
|
||||||
{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
|
{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
|
||||||
};
|
};
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC pipelineDesc;
|
D3D12_GRAPHICS_PIPELINE_STATE_DESC pipelineDesc;
|
||||||
ID3D12PipelineState *pipelineState = NULL;
|
ID3D12PipelineState *pipelineState = NULL;
|
||||||
D3D12_PipelineState *pipelineStates;
|
D3D12_PipelineState *pipelineStates;
|
||||||
|
@ -838,7 +838,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
|
||||||
typedef HANDLE(WINAPI * PFN_CREATE_EVENT_EX)(LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
typedef HANDLE(WINAPI * PFN_CREATE_EVENT_EX)(LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess);
|
||||||
PFN_CREATE_EVENT_EX CreateEventExFunc;
|
PFN_CREATE_EVENT_EX CreateEventExFunc;
|
||||||
|
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
ID3D12Device *d3dDevice = NULL;
|
ID3D12Device *d3dDevice = NULL;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
UINT creationFlags = 0;
|
UINT creationFlags = 0;
|
||||||
|
@ -1219,7 +1219,7 @@ static BOOL D3D12_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation)
|
||||||
|
|
||||||
static int D3D12_GetRotationForCurrentRenderTarget(SDL_Renderer *renderer)
|
static int D3D12_GetRotationForCurrentRenderTarget(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
if (data->textureRenderTarget) {
|
if (data->textureRenderTarget) {
|
||||||
return DXGI_MODE_ROTATION_IDENTITY;
|
return DXGI_MODE_ROTATION_IDENTITY;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1229,7 +1229,7 @@ static int D3D12_GetRotationForCurrentRenderTarget(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D12_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rect *sdlRect, D3D12_RECT *outRect, BOOL includeViewportOffset)
|
static int D3D12_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rect *sdlRect, D3D12_RECT *outRect, BOOL includeViewportOffset)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
const int rotation = D3D12_GetRotationForCurrentRenderTarget(renderer);
|
const int rotation = D3D12_GetRotationForCurrentRenderTarget(renderer);
|
||||||
const SDL_Rect *viewport = &data->currentViewport;
|
const SDL_Rect *viewport = &data->currentViewport;
|
||||||
|
|
||||||
|
@ -1273,7 +1273,7 @@ static int D3D12_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rec
|
||||||
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
||||||
static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
IDXGISwapChain1 *swapChain = NULL;
|
IDXGISwapChain1 *swapChain = NULL;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
|
|
||||||
|
@ -1419,7 +1419,7 @@ D3D12_HandleDeviceLost(SDL_Renderer *renderer)
|
||||||
/* Initialize all resources that change when the window's size changes. */
|
/* Initialize all resources that change when the window's size changes. */
|
||||||
static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
int i, w, h;
|
int i, w, h;
|
||||||
|
|
||||||
|
@ -1545,7 +1545,7 @@ done:
|
||||||
/* This method is called when the window's size changes. */
|
/* This method is called when the window's size changes. */
|
||||||
static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer *renderer)
|
static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
/* If the GPU has previous work, wait for it to be done first */
|
/* If the GPU has previous work, wait for it to be done first */
|
||||||
D3D12_WaitForGPU(data);
|
D3D12_WaitForGPU(data);
|
||||||
return D3D12_CreateWindowSizeDependentResources(renderer);
|
return D3D12_CreateWindowSizeDependentResources(renderer);
|
||||||
|
@ -1553,7 +1553,7 @@ static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D12_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
static void D3D12_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
||||||
data->pixelSizeChanged = SDL_TRUE;
|
data->pixelSizeChanged = SDL_TRUE;
|
||||||
|
@ -1580,7 +1580,7 @@ static SDL_bool D3D12_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode bl
|
||||||
|
|
||||||
static SIZE_T D3D12_GetAvailableSRVIndex(SDL_Renderer *renderer)
|
static SIZE_T D3D12_GetAvailableSRVIndex(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
if (rendererData->srvPoolHead) {
|
if (rendererData->srvPoolHead) {
|
||||||
SIZE_T index = rendererData->srvPoolHead->index;
|
SIZE_T index = rendererData->srvPoolHead->index;
|
||||||
rendererData->srvPoolHead = (D3D12_SRVPoolNode *)(rendererData->srvPoolHead->next);
|
rendererData->srvPoolHead = (D3D12_SRVPoolNode *)(rendererData->srvPoolHead->next);
|
||||||
|
@ -1593,7 +1593,7 @@ static SIZE_T D3D12_GetAvailableSRVIndex(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void D3D12_FreeSRVIndex(SDL_Renderer *renderer, SIZE_T index)
|
static void D3D12_FreeSRVIndex(SDL_Renderer *renderer, SIZE_T index)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
rendererData->srvPoolNodes[index].next = rendererData->srvPoolHead;
|
rendererData->srvPoolNodes[index].next = rendererData->srvPoolHead;
|
||||||
rendererData->srvPoolHead = &rendererData->srvPoolNodes[index];
|
rendererData->srvPoolHead = &rendererData->srvPoolNodes[index];
|
||||||
}
|
}
|
||||||
|
@ -1612,7 +1612,7 @@ static int GetTextureProperty(SDL_PropertiesID props, const char *name, ID3D12Re
|
||||||
|
|
||||||
static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData;
|
D3D12_TextureData *textureData;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
DXGI_FORMAT textureFormat = SDLPixelFormatToDXGITextureFormat(texture->format, renderer->output_colorspace);
|
DXGI_FORMAT textureFormat = SDLPixelFormatToDXGITextureFormat(texture->format, renderer->output_colorspace);
|
||||||
|
@ -1630,7 +1630,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
}
|
}
|
||||||
textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||||
|
|
||||||
texture->driverdata = textureData;
|
texture->internal = textureData;
|
||||||
textureData->mainTextureFormat = textureFormat;
|
textureData->mainTextureFormat = textureFormat;
|
||||||
|
|
||||||
SDL_zero(textureDesc);
|
SDL_zero(textureDesc);
|
||||||
|
@ -1834,8 +1834,8 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
static void D3D12_DestroyTexture(SDL_Renderer *renderer,
|
static void D3D12_DestroyTexture(SDL_Renderer *renderer,
|
||||||
SDL_Texture *texture)
|
SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -1861,7 +1861,7 @@ static void D3D12_DestroyTexture(SDL_Renderer *renderer,
|
||||||
SDL_free(textureData->pixels);
|
SDL_free(textureData->pixels);
|
||||||
#endif
|
#endif
|
||||||
SDL_free(textureData);
|
SDL_free(textureData);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Resource *texture, int plane, int x, int y, int w, int h, const void *pixels, int pitch, D3D12_RESOURCE_STATES *resourceState)
|
static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Resource *texture, int plane, int x, int y, int w, int h, const void *pixels, int pitch, D3D12_RESOURCE_STATES *resourceState)
|
||||||
|
@ -2006,8 +2006,8 @@ static int D3D12_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *srcPixels,
|
const SDL_Rect *rect, const void *srcPixels,
|
||||||
int srcPitch)
|
int srcPitch)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2056,8 +2056,8 @@ static int D3D12_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Uplane, int Upitch,
|
const Uint8 *Uplane, int Upitch,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2080,8 +2080,8 @@ static int D3D12_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Yplane, int Ypitch,
|
const Uint8 *Yplane, int Ypitch,
|
||||||
const Uint8 *UVplane, int UVpitch)
|
const Uint8 *UVplane, int UVpitch)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2101,8 +2101,8 @@ static int D3D12_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
|
|
||||||
D3D12_RESOURCE_DESC textureDesc;
|
D3D12_RESOURCE_DESC textureDesc;
|
||||||
|
@ -2221,8 +2221,8 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
D3D12_RESOURCE_DESC textureDesc;
|
D3D12_RESOURCE_DESC textureDesc;
|
||||||
D3D12_SUBRESOURCE_FOOTPRINT pitchedDesc;
|
D3D12_SUBRESOURCE_FOOTPRINT pitchedDesc;
|
||||||
|
@ -2300,7 +2300,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -2311,7 +2311,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||||
|
|
||||||
static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = NULL;
|
D3D12_TextureData *textureData = NULL;
|
||||||
|
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
|
@ -2326,7 +2326,7 @@ static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
textureData = (D3D12_TextureData *)texture->driverdata;
|
textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData->mainTextureRenderTargetView.ptr) {
|
if (!textureData->mainTextureRenderTargetView.ptr) {
|
||||||
return SDL_SetError("specified texture is not a render target");
|
return SDL_SetError("specified texture is not a render target");
|
||||||
|
@ -2385,7 +2385,7 @@ static int D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||||
int count = indices ? num_indices : num_vertices;
|
int count = indices ? num_indices : num_vertices;
|
||||||
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
||||||
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
|
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
|
||||||
D3D12_TextureData *textureData = texture ? (D3D12_TextureData *)texture->driverdata : NULL;
|
D3D12_TextureData *textureData = texture ? (D3D12_TextureData *)texture->internal : NULL;
|
||||||
float u_scale = textureData ? (float)texture->w / textureData->w : 0.0f;
|
float u_scale = textureData ? (float)texture->w / textureData->w : 0.0f;
|
||||||
float v_scale = textureData ? (float)texture->h / textureData->h : 0.0f;
|
float v_scale = textureData ? (float)texture->h / textureData->h : 0.0f;
|
||||||
|
|
||||||
|
@ -2435,7 +2435,7 @@ static int D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||||
static int D3D12_UpdateVertexBuffer(SDL_Renderer *renderer,
|
static int D3D12_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
const void *vertexData, size_t dataSizeInBytes)
|
const void *vertexData, size_t dataSizeInBytes)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
const int vbidx = rendererData->currentVertexBuffer;
|
const int vbidx = rendererData->currentVertexBuffer;
|
||||||
UINT8 *vertexBufferData = NULL;
|
UINT8 *vertexBufferData = NULL;
|
||||||
|
@ -2484,7 +2484,7 @@ static int D3D12_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
|
|
||||||
static int D3D12_UpdateViewport(SDL_Renderer *renderer)
|
static int D3D12_UpdateViewport(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
const SDL_Rect *viewport = &data->currentViewport;
|
const SDL_Rect *viewport = &data->currentViewport;
|
||||||
Float4X4 projection;
|
Float4X4 projection;
|
||||||
Float4X4 view;
|
Float4X4 view;
|
||||||
|
@ -2583,7 +2583,7 @@ static void D3D12_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderC
|
||||||
constants->color_scale = cmd->data.draw.color_scale;
|
constants->color_scale = cmd->data.draw.color_scale;
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
|
|
||||||
switch (texture->format) {
|
switch (texture->format) {
|
||||||
case SDL_PIXELFORMAT_YV12:
|
case SDL_PIXELFORMAT_YV12:
|
||||||
|
@ -2641,7 +2641,7 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE *sampler, const Float4X4 *matrix)
|
D3D12_CPU_DESCRIPTOR_HANDLE *sampler, const Float4X4 *matrix)
|
||||||
|
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity;
|
const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity;
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE renderTargetView = D3D12_GetCurrentRenderTargetView(renderer);
|
D3D12_CPU_DESCRIPTOR_HANDLE renderTargetView = D3D12_GetCurrentRenderTargetView(renderer);
|
||||||
const SDL_BlendMode blendMode = cmd->data.draw.blend;
|
const SDL_BlendMode blendMode = cmd->data.draw.blend;
|
||||||
|
@ -2788,8 +2788,8 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||||
static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix)
|
static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix)
|
||||||
{
|
{
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->internal;
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE *textureSampler;
|
D3D12_CPU_DESCRIPTOR_HANDLE *textureSampler;
|
||||||
PixelShaderConstants constants;
|
PixelShaderConstants constants;
|
||||||
|
|
||||||
|
@ -2842,14 +2842,14 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||||
|
|
||||||
static void D3D12_DrawPrimitives(SDL_Renderer *renderer, D3D12_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
static void D3D12_DrawPrimitives(SDL_Renderer *renderer, D3D12_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
D3D_CALL(rendererData->commandList, IASetPrimitiveTopology, primitiveTopology);
|
D3D_CALL(rendererData->commandList, IASetPrimitiveTopology, primitiveTopology);
|
||||||
D3D_CALL(rendererData->commandList, DrawInstanced, (UINT)vertexCount, 1, (UINT)vertexStart, 0);
|
D3D_CALL(rendererData->commandList, DrawInstanced, (UINT)vertexCount, 1, (UINT)vertexStart, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void D3D12_InvalidateCachedState(SDL_Renderer *renderer)
|
static void D3D12_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
data->currentRenderTargetView.ptr = 0;
|
data->currentRenderTargetView.ptr = 0;
|
||||||
data->currentShaderResource.ptr = 0;
|
data->currentShaderResource.ptr = 0;
|
||||||
data->currentSampler.ptr = 0;
|
data->currentSampler.ptr = 0;
|
||||||
|
@ -2859,7 +2859,7 @@ static void D3D12_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D12_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int D3D12_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->internal;
|
||||||
const int viewportRotation = D3D12_GetRotationForCurrentRenderTarget(renderer);
|
const int viewportRotation = D3D12_GetRotationForCurrentRenderTarget(renderer);
|
||||||
|
|
||||||
if (rendererData->pixelSizeChanged) {
|
if (rendererData->pixelSizeChanged) {
|
||||||
|
@ -2995,7 +2995,7 @@ static int D3D12_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||||
|
|
||||||
static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
ID3D12Resource *backBuffer = NULL;
|
ID3D12Resource *backBuffer = NULL;
|
||||||
ID3D12Resource *readbackBuffer = NULL;
|
ID3D12Resource *readbackBuffer = NULL;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
@ -3142,7 +3142,7 @@ done:
|
||||||
|
|
||||||
static int D3D12_RenderPresent(SDL_Renderer *renderer)
|
static int D3D12_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
/* Transition the render target to present state */
|
/* Transition the render target to present state */
|
||||||
|
@ -3212,7 +3212,7 @@ static int D3D12_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int D3D12_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int D3D12_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
|
D3D12_RenderData *data = (D3D12_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (vsync < 0) {
|
if (vsync < 0) {
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
|
@ -3281,7 +3281,7 @@ int D3D12_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propert
|
||||||
renderer->DestroyTexture = D3D12_DestroyTexture;
|
renderer->DestroyTexture = D3D12_DestroyTexture;
|
||||||
renderer->DestroyRenderer = D3D12_DestroyRenderer;
|
renderer->DestroyRenderer = D3D12_DestroyRenderer;
|
||||||
renderer->SetVSync = D3D12_SetVSync;
|
renderer->SetVSync = D3D12_SetVSync;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
D3D12_InvalidateCachedState(renderer);
|
D3D12_InvalidateCachedState(renderer);
|
||||||
|
|
||||||
renderer->name = D3D12_RenderDriver.name;
|
renderer->name = D3D12_RenderDriver.name;
|
||||||
|
|
|
@ -440,7 +440,7 @@ static inline id<MTLRenderPipelineState> ChoosePipelineState(METAL_RenderData *d
|
||||||
|
|
||||||
static SDL_bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLoadAction load, MTLClearColor *clear_color, id<MTLBuffer> vertex_buffer)
|
static SDL_bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLoadAction load, MTLClearColor *clear_color, id<MTLBuffer> vertex_buffer)
|
||||||
{
|
{
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
/* Our SetRenderTarget just signals that the next render operation should
|
/* Our SetRenderTarget just signals that the next render operation should
|
||||||
* set up a new render pass. This is where that work happens. */
|
* set up a new render pass. This is where that work happens. */
|
||||||
|
@ -448,7 +448,7 @@ static SDL_bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLo
|
||||||
id<MTLTexture> mtltexture = nil;
|
id<MTLTexture> mtltexture = nil;
|
||||||
|
|
||||||
if (renderer->target != NULL) {
|
if (renderer->target != NULL) {
|
||||||
METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->driverdata;
|
METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->internal;
|
||||||
mtltexture = texdata.mtltexture;
|
mtltexture = texdata.mtltexture;
|
||||||
} else {
|
} else {
|
||||||
if (data.mtlbackbuffer == nil) {
|
if (data.mtlbackbuffer == nil) {
|
||||||
|
@ -512,7 +512,7 @@ static void METAL_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *eve
|
||||||
static int METAL_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
static int METAL_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
if (w) {
|
if (w) {
|
||||||
*w = (int)data.mtllayer.drawableSize.width;
|
*w = (int)data.mtllayer.drawableSize.width;
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ size_t GetYCbCRtoRGBConversionMatrix(SDL_Colorspace colorspace, int w, int h, in
|
||||||
static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
MTLPixelFormat pixfmt;
|
MTLPixelFormat pixfmt;
|
||||||
MTLTextureDescriptor *mtltexdesc;
|
MTLTextureDescriptor *mtltexdesc;
|
||||||
id<MTLTexture> mtltexture = nil, mtltextureUv = nil;
|
id<MTLTexture> mtltexture = nil, mtltextureUv = nil;
|
||||||
|
@ -766,7 +766,7 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
texturedata.conversionBufferOffset = offset;
|
texturedata.conversionBufferOffset = offset;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
texture->driverdata = (void *)CFBridgingRetain(texturedata);
|
texture->internal = (void *)CFBridgingRetain(texturedata);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ static int METAL_UpdateTextureInternal(SDL_Renderer *renderer, METAL_TextureData
|
||||||
id<MTLTexture> texture, SDL_Rect rect, int slice,
|
id<MTLTexture> texture, SDL_Rect rect, int slice,
|
||||||
const void *pixels, int pitch)
|
const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
SDL_Rect stagingrect = { 0, 0, rect.w, rect.h };
|
SDL_Rect stagingrect = { 0, 0, rect.w, rect.h };
|
||||||
MTLTextureDescriptor *desc;
|
MTLTextureDescriptor *desc;
|
||||||
id<MTLTexture> stagingtex;
|
id<MTLTexture> stagingtex;
|
||||||
|
@ -864,7 +864,7 @@ static int METAL_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *pixels, int pitch)
|
const SDL_Rect *rect, const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) {
|
if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -914,7 +914,7 @@ static int METAL_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
const int Uslice = 0;
|
const int Uslice = 0;
|
||||||
const int Vslice = 1;
|
const int Vslice = 1;
|
||||||
SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
|
SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
|
||||||
|
@ -946,7 +946,7 @@ static int METAL_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *UVplane, int UVpitch)
|
const Uint8 *UVplane, int UVpitch)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
|
SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
|
||||||
|
|
||||||
/* Bail out if we're supposed to update an empty rectangle */
|
/* Bail out if we're supposed to update an empty rectangle */
|
||||||
|
@ -973,8 +973,8 @@ static int METAL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
int buffersize = 0;
|
int buffersize = 0;
|
||||||
id<MTLBuffer> lockedbuffer = nil;
|
id<MTLBuffer> lockedbuffer = nil;
|
||||||
|
|
||||||
|
@ -1008,8 +1008,8 @@ static int METAL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static void METAL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void METAL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
id<MTLBlitCommandEncoder> blitcmd;
|
id<MTLBlitCommandEncoder> blitcmd;
|
||||||
SDL_Rect rect = texturedata.lockedrect;
|
SDL_Rect rect = texturedata.lockedrect;
|
||||||
int pitch = SDL_BYTESPERPIXEL(texture->format) * rect.w;
|
int pitch = SDL_BYTESPERPIXEL(texture->format) * rect.w;
|
||||||
|
@ -1095,8 +1095,8 @@ static void METAL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
static void METAL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void METAL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (scaleMode == SDL_SCALEMODE_NEAREST) {
|
if (scaleMode == SDL_SCALEMODE_NEAREST) {
|
||||||
texturedata.mtlsampler = data.mtlsamplernearest;
|
texturedata.mtlsampler = data.mtlsamplernearest;
|
||||||
|
@ -1109,7 +1109,7 @@ static void METAL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||||
static int METAL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int METAL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (data.mtlcmdencoder) {
|
if (data.mtlcmdencoder) {
|
||||||
/* End encoding for the previous render target so we can set up a new
|
/* End encoding for the previous render target so we can set up a new
|
||||||
|
@ -1399,7 +1399,7 @@ static void SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderCommand
|
||||||
|
|
||||||
static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_MetalFragmentFunction shader, PixelShaderConstants *shader_constants, const size_t constants_offset, id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
|
static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_MetalFragmentFunction shader, PixelShaderConstants *shader_constants, const size_t constants_offset, id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
|
||||||
{
|
{
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
const SDL_BlendMode blend = cmd->data.draw.blend;
|
const SDL_BlendMode blend = cmd->data.draw.blend;
|
||||||
size_t first = cmd->data.draw.first;
|
size_t first = cmd->data.draw.first;
|
||||||
id<MTLRenderPipelineState> newpipeline;
|
id<MTLRenderPipelineState> newpipeline;
|
||||||
|
@ -1491,9 +1491,9 @@ static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cm
|
||||||
static SDL_bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const size_t constants_offset,
|
static SDL_bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const size_t constants_offset,
|
||||||
id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
|
id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
|
||||||
{
|
{
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
|
||||||
PixelShaderConstants constants;
|
PixelShaderConstants constants;
|
||||||
|
|
||||||
SetupShaderConstants(renderer, cmd, texture, &constants);
|
SetupShaderConstants(renderer, cmd, texture, &constants);
|
||||||
|
@ -1505,7 +1505,7 @@ static SDL_bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cm
|
||||||
if (texture != statecache->texture) {
|
if (texture != statecache->texture) {
|
||||||
METAL_TextureData *oldtexturedata = NULL;
|
METAL_TextureData *oldtexturedata = NULL;
|
||||||
if (statecache->texture) {
|
if (statecache->texture) {
|
||||||
oldtexturedata = (__bridge METAL_TextureData *)statecache->texture->driverdata;
|
oldtexturedata = (__bridge METAL_TextureData *)statecache->texture->internal;
|
||||||
}
|
}
|
||||||
if (!oldtexturedata || (texturedata.mtlsampler != oldtexturedata.mtlsampler)) {
|
if (!oldtexturedata || (texturedata.mtlsampler != oldtexturedata.mtlsampler)) {
|
||||||
[data.mtlcmdencoder setFragmentSamplerState:texturedata.mtlsampler atIndex:0];
|
[data.mtlcmdencoder setFragmentSamplerState:texturedata.mtlsampler atIndex:0];
|
||||||
|
@ -1531,7 +1531,7 @@ static void METAL_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
id<MTLBuffer> mtlbufvertex = nil;
|
id<MTLBuffer> mtlbufvertex = nil;
|
||||||
METAL_DrawStateCache statecache;
|
METAL_DrawStateCache statecache;
|
||||||
SDL_zero(statecache);
|
SDL_zero(statecache);
|
||||||
|
@ -1680,7 +1680,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||||
static SDL_Surface *METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
id<MTLTexture> mtltexture;
|
id<MTLTexture> mtltexture;
|
||||||
MTLRegion mtlregion;
|
MTLRegion mtlregion;
|
||||||
Uint32 format;
|
Uint32 format;
|
||||||
|
@ -1745,7 +1745,7 @@ static SDL_Surface *METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec
|
||||||
static int METAL_RenderPresent(SDL_Renderer *renderer)
|
static int METAL_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
SDL_bool ready = SDL_TRUE;
|
SDL_bool ready = SDL_TRUE;
|
||||||
|
|
||||||
// If we don't have a command buffer, we can't present, so activate to get one.
|
// If we don't have a command buffer, we can't present, so activate to get one.
|
||||||
|
@ -1785,16 +1785,16 @@ static int METAL_RenderPresent(SDL_Renderer *renderer)
|
||||||
static void METAL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void METAL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
CFBridgingRelease(texture->driverdata);
|
CFBridgingRelease(texture->internal);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void METAL_DestroyRenderer(SDL_Renderer *renderer)
|
static void METAL_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
if (renderer->driverdata) {
|
if (renderer->internal) {
|
||||||
METAL_RenderData *data = CFBridgingRelease(renderer->driverdata);
|
METAL_RenderData *data = CFBridgingRelease(renderer->internal);
|
||||||
|
|
||||||
if (data.mtlcmdencoder != nil) {
|
if (data.mtlcmdencoder != nil) {
|
||||||
[data.mtlcmdencoder endEncoding];
|
[data.mtlcmdencoder endEncoding];
|
||||||
|
@ -1814,7 +1814,7 @@ static void METAL_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
static void *METAL_GetMetalLayer(SDL_Renderer *renderer)
|
static void *METAL_GetMetalLayer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
return (__bridge void *)data.mtllayer;
|
return (__bridge void *)data.mtllayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1827,7 +1827,7 @@ static void *METAL_GetMetalCommandEncoder(SDL_Renderer *renderer)
|
||||||
// usable for presentation. Check your return values!
|
// usable for presentation. Check your return values!
|
||||||
METAL_RenderData *data;
|
METAL_RenderData *data;
|
||||||
METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil);
|
METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil);
|
||||||
data = (__bridge METAL_RenderData *)renderer->driverdata;
|
data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
return (__bridge void *)data.mtlcmdencoder;
|
return (__bridge void *)data.mtlcmdencoder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1836,7 +1836,7 @@ static int METAL_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
#if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
|
#if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
|
||||||
if (@available(macOS 10.13, *)) {
|
if (@available(macOS 10.13, *)) {
|
||||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
|
||||||
switch (vsync) {
|
switch (vsync) {
|
||||||
case 0:
|
case 0:
|
||||||
data.mtllayer.displaySyncEnabled = NO;
|
data.mtllayer.displaySyncEnabled = NO;
|
||||||
|
@ -2012,7 +2012,7 @@ static int METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_
|
||||||
return SDL_SetError("METAL_RenderData alloc/init failed");
|
return SDL_SetError("METAL_RenderData alloc/init failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->driverdata = (void *)CFBridgingRetain(data);
|
renderer->internal = (void *)CFBridgingRetain(data);
|
||||||
METAL_InvalidateCachedState(renderer);
|
METAL_InvalidateCachedState(renderer);
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ static const char *GL_TranslateError(GLenum error)
|
||||||
|
|
||||||
static void GL_ClearErrors(SDL_Renderer *renderer)
|
static void GL_ClearErrors(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (!data->debug_enabled) {
|
if (!data->debug_enabled) {
|
||||||
return;
|
return;
|
||||||
|
@ -198,7 +198,7 @@ static void GL_ClearErrors(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
|
static int GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!data->debug_enabled) {
|
if (!data->debug_enabled) {
|
||||||
|
@ -259,7 +259,7 @@ static int GL_LoadFunctions(GL_RenderData *data)
|
||||||
|
|
||||||
static int GL_ActivateRenderer(SDL_Renderer *renderer)
|
static int GL_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (SDL_GL_GetCurrentContext() != data->context) {
|
if (SDL_GL_GetCurrentContext() != data->context) {
|
||||||
if (SDL_GL_MakeCurrent(renderer->window, data->context) < 0) {
|
if (SDL_GL_MakeCurrent(renderer->window, data->context) < 0) {
|
||||||
|
@ -275,7 +275,7 @@ static int GL_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
static void APIENTRY GL_HandleDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam)
|
static void APIENTRY GL_HandleDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam)
|
||||||
{
|
{
|
||||||
SDL_Renderer *renderer = (SDL_Renderer *)userParam;
|
SDL_Renderer *renderer = (SDL_Renderer *)userParam;
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (type == GL_DEBUG_TYPE_ERROR_ARB) {
|
if (type == GL_DEBUG_TYPE_ERROR_ARB) {
|
||||||
/* Record this error */
|
/* Record this error */
|
||||||
|
@ -329,7 +329,7 @@ static void GL_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
*/
|
*/
|
||||||
if (event->type == SDL_EVENT_WINDOW_RESIZED ||
|
if (event->type == SDL_EVENT_WINDOW_RESIZED ||
|
||||||
event->type == SDL_EVENT_WINDOW_MOVED) {
|
event->type == SDL_EVENT_WINDOW_MOVED) {
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ static SDL_bool convert_format(Uint32 pixel_format, GLint *internalFormat, GLenu
|
||||||
|
|
||||||
static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
|
||||||
const GLenum textype = renderdata->textype;
|
const GLenum textype = renderdata->textype;
|
||||||
GL_TextureData *data;
|
GL_TextureData *data;
|
||||||
GLint internalFormat;
|
GLint internalFormat;
|
||||||
|
@ -510,7 +510,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texture->driverdata = data;
|
texture->internal = data;
|
||||||
|
|
||||||
if (renderdata->GL_ARB_texture_non_power_of_two_supported) {
|
if (renderdata->GL_ARB_texture_non_power_of_two_supported) {
|
||||||
texture_w = texture->w;
|
texture_w = texture->w;
|
||||||
|
@ -692,9 +692,9 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||||
static int GL_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int GL_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *pixels, int pitch)
|
const SDL_Rect *rect, const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
|
||||||
const GLenum textype = renderdata->textype;
|
const GLenum textype = renderdata->textype;
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
const int texturebpp = SDL_BYTESPERPIXEL(texture->format);
|
const int texturebpp = SDL_BYTESPERPIXEL(texture->format);
|
||||||
|
|
||||||
SDL_assert_release(texturebpp != 0); /* otherwise, division by zero later. */
|
SDL_assert_release(texturebpp != 0); /* otherwise, division by zero later. */
|
||||||
|
@ -757,9 +757,9 @@ static int GL_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Uplane, int Upitch,
|
const Uint8 *Uplane, int Upitch,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
|
||||||
const GLenum textype = renderdata->textype;
|
const GLenum textype = renderdata->textype;
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -792,9 +792,9 @@ static int GL_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Yplane, int Ypitch,
|
const Uint8 *Yplane, int Ypitch,
|
||||||
const Uint8 *UVplane, int UVpitch)
|
const Uint8 *UVplane, int UVpitch)
|
||||||
{
|
{
|
||||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
|
||||||
const GLenum textype = renderdata->textype;
|
const GLenum textype = renderdata->textype;
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -820,7 +820,7 @@ static int GL_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int GL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int GL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
|
|
||||||
data->locked_rect = *rect;
|
data->locked_rect = *rect;
|
||||||
*pixels =
|
*pixels =
|
||||||
|
@ -832,7 +832,7 @@ static int GL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void GL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void GL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
const SDL_Rect *rect;
|
const SDL_Rect *rect;
|
||||||
void *pixels;
|
void *pixels;
|
||||||
|
|
||||||
|
@ -845,9 +845,9 @@ static void GL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void GL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void GL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
|
||||||
const GLenum textype = renderdata->textype;
|
const GLenum textype = renderdata->textype;
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||||
|
|
||||||
renderdata->glBindTexture(textype, data->texture);
|
renderdata->glBindTexture(textype, data->texture);
|
||||||
|
@ -877,7 +877,7 @@ static void GL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static int GL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int GL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
GL_TextureData *texturedata;
|
GL_TextureData *texturedata;
|
||||||
GLenum status;
|
GLenum status;
|
||||||
|
|
||||||
|
@ -894,7 +894,7 @@ static int GL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
texturedata = (GL_TextureData *)texture->driverdata;
|
texturedata = (GL_TextureData *)texture->internal;
|
||||||
data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, texturedata->fbo->FBO);
|
data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, texturedata->fbo->FBO);
|
||||||
/* TODO: check if texture pixel format allows this operation */
|
/* TODO: check if texture pixel format allows this operation */
|
||||||
data->glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, data->textype, texturedata->texture, 0);
|
data->glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, data->textype, texturedata->texture, 0);
|
||||||
|
@ -990,7 +990,7 @@ static int GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
texturedata = (GL_TextureData *)texture->driverdata;
|
texturedata = (GL_TextureData *)texture->internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->data.draw.count = count;
|
cmd->data.draw.count = count;
|
||||||
|
@ -1144,7 +1144,7 @@ static int SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const
|
||||||
static int SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd)
|
static int SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
const GL_TextureData *texturedata = (GL_TextureData *)texture->driverdata;
|
const GL_TextureData *texturedata = (GL_TextureData *)texture->internal;
|
||||||
|
|
||||||
SetDrawState(data, cmd, texturedata->shader, texturedata->shader_params);
|
SetDrawState(data, cmd, texturedata->shader, texturedata->shader_params);
|
||||||
|
|
||||||
|
@ -1182,7 +1182,7 @@ static int SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
static void GL_InvalidateCachedState(SDL_Renderer *renderer)
|
static void GL_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GL_DrawStateCache *cache = &((GL_RenderData *)renderer->driverdata)->drawstate;
|
GL_DrawStateCache *cache = &((GL_RenderData *)renderer->internal)->drawstate;
|
||||||
cache->viewport_dirty = SDL_TRUE;
|
cache->viewport_dirty = SDL_TRUE;
|
||||||
cache->texture = NULL;
|
cache->texture = NULL;
|
||||||
cache->drawablew = 0;
|
cache->drawablew = 0;
|
||||||
|
@ -1202,7 +1202,7 @@ static void GL_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
/* !!! FIXME: it'd be nice to use a vertex buffer instead of immediate mode... */
|
/* !!! FIXME: it'd be nice to use a vertex buffer instead of immediate mode... */
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (GL_ActivateRenderer(renderer) < 0) {
|
if (GL_ActivateRenderer(renderer) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1449,7 +1449,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||||
|
|
||||||
static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
||||||
GLint internalFormat;
|
GLint internalFormat;
|
||||||
GLenum targetFormat, type;
|
GLenum targetFormat, type;
|
||||||
|
@ -1510,8 +1510,8 @@ static int GL_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void GL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void GL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *renderdata = (GL_RenderData *)renderer->internal;
|
||||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
GL_TextureData *data = (GL_TextureData *)texture->internal;
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -1545,12 +1545,12 @@ static void GL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
#endif
|
#endif
|
||||||
SDL_free(data->pixels);
|
SDL_free(data->pixels);
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GL_DestroyRenderer(SDL_Renderer *renderer)
|
static void GL_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
if (data->context) {
|
if (data->context) {
|
||||||
|
@ -1671,7 +1671,7 @@ static int GL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pro
|
||||||
renderer->DestroyTexture = GL_DestroyTexture;
|
renderer->DestroyTexture = GL_DestroyTexture;
|
||||||
renderer->DestroyRenderer = GL_DestroyRenderer;
|
renderer->DestroyRenderer = GL_DestroyRenderer;
|
||||||
renderer->SetVSync = GL_SetVSync;
|
renderer->SetVSync = GL_SetVSync;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
GL_InvalidateCachedState(renderer);
|
GL_InvalidateCachedState(renderer);
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ static const char *GL_TranslateError(GLenum error)
|
||||||
|
|
||||||
static void GL_ClearErrors(SDL_Renderer *renderer)
|
static void GL_ClearErrors(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (!data->debug_enabled) {
|
if (!data->debug_enabled) {
|
||||||
return;
|
return;
|
||||||
|
@ -225,7 +225,7 @@ static void GL_ClearErrors(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
|
static int GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!data->debug_enabled) {
|
if (!data->debug_enabled) {
|
||||||
|
@ -301,7 +301,7 @@ static GLES2_FBOList *GLES2_GetFBO(GLES2_RenderData *data, Uint32 w, Uint32 h)
|
||||||
|
|
||||||
static int GLES2_ActivateRenderer(SDL_Renderer *renderer)
|
static int GLES2_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (SDL_GL_GetCurrentContext() != data->context) {
|
if (SDL_GL_GetCurrentContext() != data->context) {
|
||||||
/* Null out the current program to ensure we set it again */
|
/* Null out the current program to ensure we set it again */
|
||||||
|
@ -319,7 +319,7 @@ static int GLES2_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void GLES2_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
static void GLES2_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (event->type == SDL_EVENT_WINDOW_MINIMIZED) {
|
if (event->type == SDL_EVENT_WINDOW_MINIMIZED) {
|
||||||
/* According to Apple documentation, we need to finish drawing NOW! */
|
/* According to Apple documentation, we need to finish drawing NOW! */
|
||||||
|
@ -375,7 +375,7 @@ static GLenum GetBlendEquation(SDL_BlendOperation operation)
|
||||||
|
|
||||||
static SDL_bool GLES2_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
static SDL_bool GLES2_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
|
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
|
||||||
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
|
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
|
||||||
|
@ -1032,7 +1032,7 @@ static int SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, co
|
||||||
|
|
||||||
static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertices)
|
static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertices)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
|
GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR;
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1156,7 +1156,7 @@ static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, vo
|
||||||
ret = SetDrawState(data, cmd, sourceType, vertices);
|
ret = SetDrawState(data, cmd, sourceType, vertices);
|
||||||
|
|
||||||
if (texture != data->drawstate.texture) {
|
if (texture != data->drawstate.texture) {
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
#if SDL_HAVE_YUV
|
#if SDL_HAVE_YUV
|
||||||
if (tdata->yuv) {
|
if (tdata->yuv) {
|
||||||
data->glActiveTexture(GL_TEXTURE2);
|
data->glActiveTexture(GL_TEXTURE2);
|
||||||
|
@ -1182,7 +1182,7 @@ static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, vo
|
||||||
|
|
||||||
static void GLES2_InvalidateCachedState(SDL_Renderer *renderer)
|
static void GLES2_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GLES2_DrawStateCache *cache = &((GLES2_RenderData *)renderer->driverdata)->drawstate;
|
GLES2_DrawStateCache *cache = &((GLES2_RenderData *)renderer->internal)->drawstate;
|
||||||
cache->viewport_dirty = SDL_TRUE;
|
cache->viewport_dirty = SDL_TRUE;
|
||||||
cache->texture = NULL;
|
cache->texture = NULL;
|
||||||
cache->blend = SDL_BLENDMODE_INVALID;
|
cache->blend = SDL_BLENDMODE_INVALID;
|
||||||
|
@ -1197,7 +1197,7 @@ static void GLES2_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_BGRA32 || renderer->target->format == SDL_PIXELFORMAT_BGRX32));
|
const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_BGRA32 || renderer->target->format == SDL_PIXELFORMAT_BGRX32));
|
||||||
|
|
||||||
#if USE_VERTEX_BUFFER_OBJECTS
|
#if USE_VERTEX_BUFFER_OBJECTS
|
||||||
|
@ -1399,7 +1399,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||||
|
|
||||||
static void GLES2_DestroyRenderer(SDL_Renderer *renderer)
|
static void GLES2_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
/* Deallocate everything */
|
/* Deallocate everything */
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -1449,7 +1449,7 @@ static void GLES2_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *renderdata = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *renderdata = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *data;
|
GLES2_TextureData *data;
|
||||||
GLenum format;
|
GLenum format;
|
||||||
GLenum type;
|
GLenum type;
|
||||||
|
@ -1618,7 +1618,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texture->driverdata = data;
|
texture->internal = data;
|
||||||
renderdata->glActiveTexture(GL_TEXTURE0);
|
renderdata->glActiveTexture(GL_TEXTURE0);
|
||||||
renderdata->glBindTexture(data->texture_type, data->texture);
|
renderdata->glBindTexture(data->texture_type, data->texture);
|
||||||
renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
|
renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MIN_FILTER, scaleMode);
|
||||||
|
@ -1635,7 +1635,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER, data->texture_type);
|
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER, data->texture_type);
|
||||||
|
|
||||||
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
||||||
data->fbo = GLES2_GetFBO((GLES2_RenderData *)renderer->driverdata, texture->w, texture->h);
|
data->fbo = GLES2_GetFBO((GLES2_RenderData *)renderer->internal, texture->w, texture->h);
|
||||||
} else {
|
} else {
|
||||||
data->fbo = NULL;
|
data->fbo = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1681,8 +1681,8 @@ static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoff
|
||||||
static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
|
static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
|
||||||
const void *pixels, int pitch)
|
const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
|
|
||||||
GLES2_ActivateRenderer(renderer);
|
GLES2_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -1762,8 +1762,8 @@ static int GLES2_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Uplane, int Upitch,
|
const Uint8 *Uplane, int Upitch,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
|
|
||||||
GLES2_ActivateRenderer(renderer);
|
GLES2_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -1812,8 +1812,8 @@ static int GLES2_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Yplane, int Ypitch,
|
const Uint8 *Yplane, int Ypitch,
|
||||||
const Uint8 *UVplane, int UVpitch)
|
const Uint8 *UVplane, int UVpitch)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
|
|
||||||
GLES2_ActivateRenderer(renderer);
|
GLES2_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -1851,7 +1851,7 @@ static int GLES2_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
|
static int GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
|
||||||
void **pixels, int *pitch)
|
void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
|
|
||||||
/* Retrieve the buffer/pitch for the specified region */
|
/* Retrieve the buffer/pitch for the specified region */
|
||||||
*pixels = (Uint8 *)tdata->pixel_data +
|
*pixels = (Uint8 *)tdata->pixel_data +
|
||||||
|
@ -1864,7 +1864,7 @@ static int GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const
|
||||||
|
|
||||||
static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
|
|
||||||
/* We do whole texture updates, at least for now */
|
/* We do whole texture updates, at least for now */
|
||||||
|
@ -1877,8 +1877,8 @@ static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void GLES2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void GLES2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *renderdata = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *renderdata = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *data = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *data = (GLES2_TextureData *)texture->internal;
|
||||||
GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||||
|
|
||||||
#if SDL_HAVE_YUV
|
#if SDL_HAVE_YUV
|
||||||
|
@ -1908,7 +1908,7 @@ static void GLES2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||||
|
|
||||||
static int GLES2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int GLES2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *texturedata = NULL;
|
GLES2_TextureData *texturedata = NULL;
|
||||||
GLenum status;
|
GLenum status;
|
||||||
|
|
||||||
|
@ -1917,7 +1917,7 @@ static int GLES2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer);
|
data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer);
|
||||||
} else {
|
} else {
|
||||||
texturedata = (GLES2_TextureData *)texture->driverdata;
|
texturedata = (GLES2_TextureData *)texture->internal;
|
||||||
data->glBindFramebuffer(GL_FRAMEBUFFER, texturedata->fbo->FBO);
|
data->glBindFramebuffer(GL_FRAMEBUFFER, texturedata->fbo->FBO);
|
||||||
/* TODO: check if texture pixel format allows this operation */
|
/* TODO: check if texture pixel format allows this operation */
|
||||||
data->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texturedata->texture_type, texturedata->texture, 0);
|
data->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texturedata->texture_type, texturedata->texture, 0);
|
||||||
|
@ -1932,8 +1932,8 @@ static int GLES2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata;
|
GLES2_TextureData *tdata = (GLES2_TextureData *)texture->internal;
|
||||||
|
|
||||||
GLES2_ActivateRenderer(renderer);
|
GLES2_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
@ -1959,13 +1959,13 @@ static void GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
#endif
|
#endif
|
||||||
SDL_free(tdata->pixel_data);
|
SDL_free(tdata->pixel_data);
|
||||||
SDL_free(tdata);
|
SDL_free(tdata);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_Surface *GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface *GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
|
GLES2_RenderData *data = (GLES2_RenderData *)renderer->internal;
|
||||||
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32;
|
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32;
|
||||||
int w, h;
|
int w, h;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
@ -2091,7 +2091,7 @@ static int GLES2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_
|
||||||
if (!data) {
|
if (!data) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
GLES2_InvalidateCachedState(renderer);
|
GLES2_InvalidateCachedState(renderer);
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ static int PS2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture->driverdata = ps2_tex;
|
texture->internal = ps2_tex;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ static int PS2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||||
static int PS2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int PS2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->driverdata;
|
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->internal;
|
||||||
|
|
||||||
*pixels =
|
*pixels =
|
||||||
(void *)((Uint8 *)ps2_texture->Mem + rect->y * ps2_texture->Width * SDL_BYTESPERPIXEL(texture->format) +
|
(void *)((Uint8 *)ps2_texture->Mem + rect->y * ps2_texture->Width * SDL_BYTESPERPIXEL(texture->format) +
|
||||||
|
@ -164,8 +164,8 @@ static int PS2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void PS2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void PS2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->driverdata;
|
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->internal;
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
gsKit_TexManager_invalidate(data->gsGlobal, ps2_texture);
|
gsKit_TexManager_invalidate(data->gsGlobal, ps2_texture);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ static int PS2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void PS2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void PS2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->driverdata;
|
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->internal;
|
||||||
/*
|
/*
|
||||||
set texture filtering according to scaleMode
|
set texture filtering according to scaleMode
|
||||||
supported hint values are nearest (0, default) or linear (1)
|
supported hint values are nearest (0, default) or linear (1)
|
||||||
|
@ -217,7 +217,7 @@ static int PS2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static int PS2_QueueSetViewport(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
static int PS2_QueueSetViewport(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
const SDL_Rect *viewport = &cmd->data.viewport.rect;
|
const SDL_Rect *viewport = &cmd->data.viewport.rect;
|
||||||
data->viewport = (SDL_Rect *)viewport;
|
data->viewport = (SDL_Rect *)viewport;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ static int PS2_QueueNoOp(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
static int PS2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
static int PS2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
GSPRIMPOINT *vertices = (GSPRIMPOINT *)SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMPOINT), 4, &cmd->data.draw.first);
|
GSPRIMPOINT *vertices = (GSPRIMPOINT *)SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMPOINT), 4, &cmd->data.draw.first);
|
||||||
gs_rgbaq rgbaq;
|
gs_rgbaq rgbaq;
|
||||||
int i;
|
int i;
|
||||||
|
@ -262,7 +262,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int count = indices ? num_indices : num_vertices;
|
int count = indices ? num_indices : num_vertices;
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
const float color_scale = cmd->data.draw.color_scale;
|
const float color_scale = cmd->data.draw.color_scale;
|
||||||
|
|
||||||
cmd->data.draw.count = count;
|
cmd->data.draw.count = count;
|
||||||
|
@ -270,7 +270,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
GSPRIMUVPOINT *vertices = (GSPRIMUVPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMUVPOINT), 4, &cmd->data.draw.first);
|
GSPRIMUVPOINT *vertices = (GSPRIMUVPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMUVPOINT), 4, &cmd->data.draw.first);
|
||||||
GSTEXTURE *ps2_tex = (GSTEXTURE *) texture->driverdata;
|
GSTEXTURE *ps2_tex = (GSTEXTURE *) texture->internal;
|
||||||
|
|
||||||
if (!vertices) {
|
if (!vertices) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -343,7 +343,7 @@ static int PS2_RenderSetViewPort(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
static int PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
static int PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
SDL_Rect *viewport = data->viewport;
|
SDL_Rect *viewport = data->viewport;
|
||||||
|
|
||||||
const SDL_Rect *rect = &cmd->data.cliprect.rect;
|
const SDL_Rect *rect = &cmd->data.cliprect.rect;
|
||||||
|
@ -362,7 +362,7 @@ static int PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
static int PS2_RenderSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
static int PS2_RenderSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
data->drawColor = float_GS_SETREG_RGBAQ(&cmd->data.color.color, cmd->data.color.color_scale);
|
data->drawColor = float_GS_SETREG_RGBAQ(&cmd->data.color.color, cmd->data.color.color_scale);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -373,7 +373,7 @@ static int PS2_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
int offsetX, offsetY;
|
int offsetX, offsetY;
|
||||||
SDL_Rect *viewport;
|
SDL_Rect *viewport;
|
||||||
|
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
/* Clear the screen, so let's put default viewport */
|
/* Clear the screen, so let's put default viewport */
|
||||||
gsKit_set_scissor(data->gsGlobal, GS_SCISSOR_RESET);
|
gsKit_set_scissor(data->gsGlobal, GS_SCISSOR_RESET);
|
||||||
|
@ -449,14 +449,14 @@ static void PS2_SetBlendMode(PS2_RenderData *data, int blendMode)
|
||||||
|
|
||||||
static int PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
|
static int PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
|
|
||||||
PS2_SetBlendMode(data, cmd->data.draw.blend);
|
PS2_SetBlendMode(data, cmd->data.draw.blend);
|
||||||
|
|
||||||
if (cmd->data.draw.texture) {
|
if (cmd->data.draw.texture) {
|
||||||
const GSPRIMUVPOINT *verts = (GSPRIMUVPOINT *) (vertices + cmd->data.draw.first);
|
const GSPRIMUVPOINT *verts = (GSPRIMUVPOINT *) (vertices + cmd->data.draw.first);
|
||||||
GSTEXTURE *ps2_tex = (GSTEXTURE *)cmd->data.draw.texture->driverdata;
|
GSTEXTURE *ps2_tex = (GSTEXTURE *)cmd->data.draw.texture->internal;
|
||||||
|
|
||||||
gsKit_TexManager_bind(data->gsGlobal, ps2_tex);
|
gsKit_TexManager_bind(data->gsGlobal, ps2_tex);
|
||||||
gsKit_prim_list_triangle_goraud_texture_uv_3d(data->gsGlobal, ps2_tex, count, verts);
|
gsKit_prim_list_triangle_goraud_texture_uv_3d(data->gsGlobal, ps2_tex, count, verts);
|
||||||
|
@ -470,7 +470,7 @@ static int PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_Render
|
||||||
|
|
||||||
int PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
|
int PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
|
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ int PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *c
|
||||||
|
|
||||||
int PS2_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
|
int PS2_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
const size_t count = cmd->data.draw.count;
|
const size_t count = cmd->data.draw.count;
|
||||||
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
|
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ static int PS2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
||||||
|
|
||||||
static int PS2_RenderPresent(SDL_Renderer *renderer)
|
static int PS2_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (data->gsGlobal->DoubleBuffering == GS_SETTING_OFF) {
|
if (data->gsGlobal->DoubleBuffering == GS_SETTING_OFF) {
|
||||||
if (data->vsync == -1) { // Dynamic
|
if (data->vsync == -1) { // Dynamic
|
||||||
|
@ -581,8 +581,8 @@ static int PS2_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void PS2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void PS2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->driverdata;
|
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->internal;
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
|
@ -597,12 +597,12 @@ static void PS2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
SDL_aligned_free(ps2_texture->Mem);
|
SDL_aligned_free(ps2_texture->Mem);
|
||||||
SDL_free(ps2_texture);
|
SDL_free(ps2_texture);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PS2_DestroyRenderer(SDL_Renderer *renderer)
|
static void PS2_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
gsKit_clear(data->gsGlobal, GS_BLACK);
|
gsKit_clear(data->gsGlobal, GS_BLACK);
|
||||||
|
@ -620,7 +620,7 @@ static void PS2_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int PS2_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int PS2_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
|
||||||
switch (vsync) {
|
switch (vsync) {
|
||||||
case -1:
|
case -1:
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -709,7 +709,7 @@ static int PS2_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pr
|
||||||
renderer->DestroyTexture = PS2_DestroyTexture;
|
renderer->DestroyTexture = PS2_DestroyTexture;
|
||||||
renderer->DestroyRenderer = PS2_DestroyRenderer;
|
renderer->DestroyRenderer = PS2_DestroyRenderer;
|
||||||
renderer->SetVSync = PS2_SetVSync;
|
renderer->SetVSync = PS2_SetVSync;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
PS2_InvalidateCachedState(renderer);
|
PS2_InvalidateCachedState(renderer);
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@ static void PSP_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event
|
||||||
|
|
||||||
static int PSP_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int PSP_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
PSP_RenderData *data = renderer->driverdata;
|
PSP_RenderData *data = renderer->internal;
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)SDL_calloc(1, sizeof(*psp_texture));
|
PSP_TextureData *psp_texture = (PSP_TextureData *)SDL_calloc(1, sizeof(*psp_texture));
|
||||||
|
|
||||||
if (!psp_texture) {
|
if (!psp_texture) {
|
||||||
|
@ -516,7 +516,7 @@ static int PSP_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||||
psp_texture->pitch = psp_texture->textureWidth * SDL_BYTESPERPIXEL(texture->format);
|
psp_texture->pitch = psp_texture->textureWidth * SDL_BYTESPERPIXEL(texture->format);
|
||||||
psp_texture->size = psp_texture->textureHeight * psp_texture->pitch;
|
psp_texture->size = psp_texture->textureHeight * psp_texture->pitch;
|
||||||
if (texture->access & SDL_TEXTUREACCESS_TARGET) {
|
if (texture->access & SDL_TEXTUREACCESS_TARGET) {
|
||||||
if (TextureSpillTargetsForSpace(renderer->driverdata, psp_texture->size) < 0) {
|
if (TextureSpillTargetsForSpace(renderer->internal, psp_texture->size) < 0) {
|
||||||
SDL_free(psp_texture);
|
SDL_free(psp_texture);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ static int PSP_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||||
SDL_free(psp_texture);
|
SDL_free(psp_texture);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
texture->driverdata = psp_texture;
|
texture->internal = psp_texture;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ static int TextureShouldSwizzle(PSP_TextureData *psp_texture, SDL_Texture *textu
|
||||||
|
|
||||||
static void TextureActivate(SDL_Texture *texture)
|
static void TextureActivate(SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->internal;
|
||||||
int scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GU_NEAREST : GU_LINEAR;
|
int scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GU_NEAREST : GU_LINEAR;
|
||||||
|
|
||||||
/* Swizzling is useless with small textures. */
|
/* Swizzling is useless with small textures. */
|
||||||
|
@ -565,7 +565,7 @@ static int PSP_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int PSP_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int PSP_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *pixels, int pitch)
|
const SDL_Rect *rect, const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
/* PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata; */
|
/* PSP_TextureData *psp_texture = (PSP_TextureData *) texture->internal; */
|
||||||
const Uint8 *src;
|
const Uint8 *src;
|
||||||
Uint8 *dst;
|
Uint8 *dst;
|
||||||
int row, length, dpitch;
|
int row, length, dpitch;
|
||||||
|
@ -590,7 +590,7 @@ static int PSP_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int PSP_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int PSP_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->internal;
|
||||||
|
|
||||||
*pixels =
|
*pixels =
|
||||||
(void *)((Uint8 *)psp_texture->data + rect->y * psp_texture->pitch +
|
(void *)((Uint8 *)psp_texture->data + rect->y * psp_texture->pitch +
|
||||||
|
@ -601,7 +601,7 @@ static int PSP_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void PSP_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void PSP_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->internal;
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
|
|
||||||
/* We do whole texture updates, at least for now */
|
/* We do whole texture updates, at least for now */
|
||||||
|
@ -695,7 +695,7 @@ static int PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||||
verts++;
|
verts++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->internal;
|
||||||
VertTCV *verts;
|
VertTCV *verts;
|
||||||
verts = (VertTCV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertTCV), 4, &cmd->data.draw.first);
|
verts = (VertTCV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertTCV), 4, &cmd->data.draw.first);
|
||||||
if (!verts) {
|
if (!verts) {
|
||||||
|
@ -951,7 +951,7 @@ static void ResetBlendState(PSP_BlendState *state)
|
||||||
|
|
||||||
static void StartDrawing(SDL_Renderer *renderer)
|
static void StartDrawing(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
PSP_RenderData *data = (PSP_RenderData *)renderer->driverdata;
|
PSP_RenderData *data = (PSP_RenderData *)renderer->internal;
|
||||||
|
|
||||||
// Check if we need to start GU displaylist
|
// Check if we need to start GU displaylist
|
||||||
if (!data->displayListAvail) {
|
if (!data->displayListAvail) {
|
||||||
|
@ -964,7 +964,7 @@ static void StartDrawing(SDL_Renderer *renderer)
|
||||||
if (renderer->target != data->boundTarget) {
|
if (renderer->target != data->boundTarget) {
|
||||||
SDL_Texture *texture = renderer->target;
|
SDL_Texture *texture = renderer->target;
|
||||||
if (texture) {
|
if (texture) {
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->internal;
|
||||||
// Set target, registering LRU
|
// Set target, registering LRU
|
||||||
TextureBindAsTarget(data, psp_texture);
|
TextureBindAsTarget(data, psp_texture);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1048,7 +1048,7 @@ static void PSP_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
PSP_RenderData *data = (PSP_RenderData *)renderer->driverdata;
|
PSP_RenderData *data = (PSP_RenderData *)renderer->internal;
|
||||||
Uint8 *gpumem = NULL;
|
Uint8 *gpumem = NULL;
|
||||||
PSP_DrawStateCache drawstate;
|
PSP_DrawStateCache drawstate;
|
||||||
|
|
||||||
|
@ -1224,7 +1224,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
||||||
|
|
||||||
static int PSP_RenderPresent(SDL_Renderer *renderer)
|
static int PSP_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
PSP_RenderData *data = (PSP_RenderData *)renderer->driverdata;
|
PSP_RenderData *data = (PSP_RenderData *)renderer->internal;
|
||||||
if (!data->displayListAvail) {
|
if (!data->displayListAvail) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1246,8 +1246,8 @@ static int PSP_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void PSP_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void PSP_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
PSP_RenderData *renderdata = (PSP_RenderData *)renderer->driverdata;
|
PSP_RenderData *renderdata = (PSP_RenderData *)renderer->internal;
|
||||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!renderdata) {
|
if (!renderdata) {
|
||||||
return;
|
return;
|
||||||
|
@ -1260,12 +1260,12 @@ static void PSP_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
LRUTargetRemove(renderdata, psp_texture);
|
LRUTargetRemove(renderdata, psp_texture);
|
||||||
TextureStorageFree(psp_texture->data);
|
TextureStorageFree(psp_texture->data);
|
||||||
SDL_free(psp_texture);
|
SDL_free(psp_texture);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PSP_DestroyRenderer(SDL_Renderer *renderer)
|
static void PSP_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
PSP_RenderData *data = (PSP_RenderData *)renderer->driverdata;
|
PSP_RenderData *data = (PSP_RenderData *)renderer->internal;
|
||||||
if (data) {
|
if (data) {
|
||||||
if (!data->initialized) {
|
if (!data->initialized) {
|
||||||
return;
|
return;
|
||||||
|
@ -1287,7 +1287,7 @@ static void PSP_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int PSP_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int PSP_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
PSP_RenderData *data = renderer->driverdata;
|
PSP_RenderData *data = renderer->internal;
|
||||||
data->vsync = vsync;
|
data->vsync = vsync;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1330,7 @@ static int PSP_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Pr
|
||||||
renderer->DestroyTexture = PSP_DestroyTexture;
|
renderer->DestroyTexture = PSP_DestroyTexture;
|
||||||
renderer->DestroyRenderer = PSP_DestroyRenderer;
|
renderer->DestroyRenderer = PSP_DestroyRenderer;
|
||||||
renderer->SetVSync = PSP_SetVSync;
|
renderer->SetVSync = PSP_SetVSync;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
PSP_InvalidateCachedState(renderer);
|
PSP_InvalidateCachedState(renderer);
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef struct
|
||||||
|
|
||||||
static SDL_Surface *SW_ActivateRenderer(SDL_Renderer *renderer)
|
static SDL_Surface *SW_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
SW_RenderData *data = (SW_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (!data->surface) {
|
if (!data->surface) {
|
||||||
data->surface = data->window;
|
data->surface = data->window;
|
||||||
|
@ -69,7 +69,7 @@ static SDL_Surface *SW_ActivateRenderer(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
SW_RenderData *data = (SW_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
||||||
data->surface = NULL;
|
data->surface = NULL;
|
||||||
|
@ -79,7 +79,7 @@ static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
|
|
||||||
static int SW_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
static int SW_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
SW_RenderData *data = (SW_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (data->surface) {
|
if (data->surface) {
|
||||||
if (w) {
|
if (w) {
|
||||||
|
@ -107,7 +107,7 @@ static int SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||||
if (!SDL_SurfaceValid(surface)) {
|
if (!SDL_SurfaceValid(surface)) {
|
||||||
return SDL_SetError("Cannot create surface");
|
return SDL_SetError("Cannot create surface");
|
||||||
}
|
}
|
||||||
texture->driverdata = surface;
|
texture->internal = surface;
|
||||||
r = (Uint8)SDL_roundf(SDL_clamp(texture->color.r, 0.0f, 1.0f) * 255.0f);
|
r = (Uint8)SDL_roundf(SDL_clamp(texture->color.r, 0.0f, 1.0f) * 255.0f);
|
||||||
g = (Uint8)SDL_roundf(SDL_clamp(texture->color.g, 0.0f, 1.0f) * 255.0f);
|
g = (Uint8)SDL_roundf(SDL_clamp(texture->color.g, 0.0f, 1.0f) * 255.0f);
|
||||||
b = (Uint8)SDL_roundf(SDL_clamp(texture->color.b, 0.0f, 1.0f) * 255.0f);
|
b = (Uint8)SDL_roundf(SDL_clamp(texture->color.b, 0.0f, 1.0f) * 255.0f);
|
||||||
|
@ -129,7 +129,7 @@ static int SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||||
static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *pixels, int pitch)
|
const SDL_Rect *rect, const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
SDL_Surface *surface = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
||||||
Uint8 *src, *dst;
|
Uint8 *src, *dst;
|
||||||
int row;
|
int row;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
@ -156,7 +156,7 @@ static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
SDL_Surface *surface = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
||||||
|
|
||||||
*pixels =
|
*pixels =
|
||||||
(void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
|
(void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
|
||||||
|
@ -175,10 +175,10 @@ static void SW_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static int SW_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int SW_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
SW_RenderData *data = (SW_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
data->surface = (SDL_Surface *)texture->driverdata;
|
data->surface = (SDL_Surface *)texture->internal;
|
||||||
} else {
|
} else {
|
||||||
data->surface = data->window;
|
data->surface = data->window;
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||||
const SDL_Rect *srcrect, const SDL_Rect *final_rect,
|
const SDL_Rect *srcrect, const SDL_Rect *final_rect,
|
||||||
const double angle, const SDL_FPoint *center, const SDL_FlipMode flip, float scale_x, float scale_y)
|
const double angle, const SDL_FPoint *center, const SDL_FlipMode flip, float scale_x, float scale_y)
|
||||||
{
|
{
|
||||||
SDL_Surface *src = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *src = (SDL_Surface *)texture->internal;
|
||||||
SDL_Rect tmp_rect;
|
SDL_Rect tmp_rect;
|
||||||
SDL_Surface *src_clone, *src_rotated, *src_scaled;
|
SDL_Surface *src_clone, *src_rotated, *src_scaled;
|
||||||
SDL_Surface *mask = NULL, *mask_rotated = NULL;
|
SDL_Surface *mask = NULL, *mask_rotated = NULL;
|
||||||
|
@ -624,7 +624,7 @@ static void PrepTextureForCopy(const SDL_RenderCommand *cmd, SW_DrawStateCache *
|
||||||
const Uint8 a = drawstate->color.a;
|
const Uint8 a = drawstate->color.a;
|
||||||
const SDL_BlendMode blend = cmd->data.draw.blend;
|
const SDL_BlendMode blend = cmd->data.draw.blend;
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
SDL_Surface *surface = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
||||||
const SDL_bool colormod = ((r & g & b) != 0xFF);
|
const SDL_bool colormod = ((r & g & b) != 0xFF);
|
||||||
const SDL_bool alphamod = (a != 0xFF);
|
const SDL_bool alphamod = (a != 0xFF);
|
||||||
const SDL_bool blending = ((blend == SDL_BLENDMODE_ADD) || (blend == SDL_BLENDMODE_MOD) || (blend == SDL_BLENDMODE_MUL));
|
const SDL_bool blending = ((blend == SDL_BLENDMODE_ADD) || (blend == SDL_BLENDMODE_MOD) || (blend == SDL_BLENDMODE_MUL));
|
||||||
|
@ -812,7 +812,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||||
const SDL_Rect *srcrect = verts;
|
const SDL_Rect *srcrect = verts;
|
||||||
SDL_Rect *dstrect = verts + 1;
|
SDL_Rect *dstrect = verts + 1;
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
SDL_Surface *src = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *src = (SDL_Surface *)texture->internal;
|
||||||
|
|
||||||
SetDrawState(surface, &drawstate);
|
SetDrawState(surface, &drawstate);
|
||||||
|
|
||||||
|
@ -900,7 +900,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||||
SetDrawState(surface, &drawstate);
|
SetDrawState(surface, &drawstate);
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
SDL_Surface *src = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *src = (SDL_Surface *)texture->internal;
|
||||||
|
|
||||||
GeometryCopyData *ptr = (GeometryCopyData *)verts;
|
GeometryCopyData *ptr = (GeometryCopyData *)verts;
|
||||||
|
|
||||||
|
@ -996,7 +996,7 @@ static int SW_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
SDL_Surface *surface = (SDL_Surface *)texture->driverdata;
|
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
||||||
|
|
||||||
SDL_DestroySurface(surface);
|
SDL_DestroySurface(surface);
|
||||||
}
|
}
|
||||||
|
@ -1004,7 +1004,7 @@ static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
static void SW_DestroyRenderer(SDL_Renderer *renderer)
|
static void SW_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
SDL_Window *window = renderer->window;
|
SDL_Window *window = renderer->window;
|
||||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
SW_RenderData *data = (SW_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
SDL_DestroyWindowSurface(window);
|
SDL_DestroyWindowSurface(window);
|
||||||
|
@ -1147,7 +1147,7 @@ int SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, SD
|
||||||
renderer->RenderPresent = SW_RenderPresent;
|
renderer->RenderPresent = SW_RenderPresent;
|
||||||
renderer->DestroyTexture = SW_DestroyTexture;
|
renderer->DestroyTexture = SW_DestroyTexture;
|
||||||
renderer->DestroyRenderer = SW_DestroyRenderer;
|
renderer->DestroyRenderer = SW_DestroyRenderer;
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
SW_InvalidateCachedState(renderer);
|
SW_InvalidateCachedState(renderer);
|
||||||
|
|
||||||
renderer->name = SW_RenderDriver.name;
|
renderer->name = SW_RenderDriver.name;
|
||||||
|
|
|
@ -134,7 +134,7 @@ static int PixelFormatToVITAFMT(Uint32 format)
|
||||||
|
|
||||||
void StartDrawing(SDL_Renderer *renderer)
|
void StartDrawing(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
if (data->drawing) {
|
if (data->drawing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ void StartDrawing(SDL_Renderer *renderer)
|
||||||
&data->displaySurface[data->backBufferIndex],
|
&data->displaySurface[data->backBufferIndex],
|
||||||
&data->depthSurface);
|
&data->depthSurface);
|
||||||
} else {
|
} else {
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)renderer->target->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)renderer->target->internal;
|
||||||
|
|
||||||
sceGxmBeginScene(
|
sceGxmBeginScene(
|
||||||
data->gxm_context,
|
data->gxm_context,
|
||||||
|
@ -182,7 +182,7 @@ void StartDrawing(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int VITA_GXM_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int VITA_GXM_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = renderer->driverdata;
|
VITA_GXM_RenderData *data = renderer->internal;
|
||||||
if (vsync) {
|
if (vsync) {
|
||||||
data->displayData.wait_vblank = SDL_TRUE;
|
data->displayData.wait_vblank = SDL_TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -231,7 +231,7 @@ static int VITA_GXM_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, S
|
||||||
renderer->DestroyRenderer = VITA_GXM_DestroyRenderer;
|
renderer->DestroyRenderer = VITA_GXM_DestroyRenderer;
|
||||||
renderer->SetVSync = VITA_GXM_SetVSync;
|
renderer->SetVSync = VITA_GXM_SetVSync;
|
||||||
|
|
||||||
renderer->driverdata = data;
|
renderer->internal = data;
|
||||||
VITA_GXM_InvalidateCachedState(renderer);
|
VITA_GXM_InvalidateCachedState(renderer);
|
||||||
renderer->window = window;
|
renderer->window = window;
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ static SDL_bool VITA_GXM_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode
|
||||||
|
|
||||||
static int VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)SDL_calloc(1, sizeof(VITA_GXM_TextureData));
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)SDL_calloc(1, sizeof(VITA_GXM_TextureData));
|
||||||
|
|
||||||
if (!vita_texture) {
|
if (!vita_texture) {
|
||||||
|
@ -296,7 +296,7 @@ static int VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
texture->driverdata = vita_texture;
|
texture->internal = vita_texture;
|
||||||
|
|
||||||
VITA_GXM_SetTextureScaleMode(renderer, texture, texture->scaleMode);
|
VITA_GXM_SetTextureScaleMode(renderer, texture, texture->scaleMode);
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ static int VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void VITA_GXM_SetYUVProfile(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void VITA_GXM_SetYUVProfile(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (SDL_ISCOLORSPACE_MATRIX_BT601(texture->colorspace)) {
|
if (SDL_ISCOLORSPACE_MATRIX_BT601(texture->colorspace)) {
|
||||||
if (SDL_ISCOLORSPACE_LIMITED_RANGE(texture->colorspace)) {
|
if (SDL_ISCOLORSPACE_LIMITED_RANGE(texture->colorspace)) {
|
||||||
|
@ -336,7 +336,7 @@ static void VITA_GXM_SetYUVProfile(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
static int VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *pixels, int pitch)
|
const SDL_Rect *rect, const void *pixels, int pitch)
|
||||||
{
|
{
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
Uint8 *dst;
|
Uint8 *dst;
|
||||||
int row, length, dpitch;
|
int row, length, dpitch;
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ static int VITA_GXM_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *textur
|
||||||
{
|
{
|
||||||
void *Udst;
|
void *Udst;
|
||||||
void *Vdst;
|
void *Vdst;
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
int uv_pitch = (dpitch + 1) / 2;
|
int uv_pitch = (dpitch + 1) / 2;
|
||||||
|
|
||||||
// skip Y plane
|
// skip Y plane
|
||||||
|
@ -529,7 +529,7 @@ static int VITA_GXM_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture
|
||||||
// UV plane
|
// UV plane
|
||||||
{
|
{
|
||||||
void *UVdst;
|
void *UVdst;
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
int uv_pitch = 2 * ((dpitch + 1) / 2);
|
int uv_pitch = 2 * ((dpitch + 1) / 2);
|
||||||
|
|
||||||
// skip Y plane
|
// skip Y plane
|
||||||
|
@ -559,8 +559,8 @@ static int VITA_GXM_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture
|
||||||
static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
|
|
||||||
*pixels =
|
*pixels =
|
||||||
(void *)((Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (rect->y * vita_texture->pitch) + rect->x * SDL_BYTESPERPIXEL(texture->format));
|
(void *)((Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (rect->y * vita_texture->pitch) + rect->x * SDL_BYTESPERPIXEL(texture->format));
|
||||||
|
@ -583,7 +583,7 @@ static void VITA_GXM_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void VITA_GXM_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void VITA_GXM_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
set texture filtering according to scaleMode
|
set texture filtering according to scaleMode
|
||||||
|
@ -640,7 +640,7 @@ static int VITA_GXM_QueueNoOp(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
static int VITA_GXM_QueueSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
static int VITA_GXM_QueueSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
|
|
||||||
data->drawstate.color.r = cmd->data.color.color.r * cmd->data.color.color_scale;
|
data->drawstate.color.r = cmd->data.color.color.r * cmd->data.color.color_scale;
|
||||||
data->drawstate.color.g = cmd->data.color.color.g * cmd->data.color.color_scale;
|
data->drawstate.color.g = cmd->data.color.color.g * cmd->data.color.color_scale;
|
||||||
|
@ -652,7 +652,7 @@ static int VITA_GXM_QueueSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand
|
||||||
|
|
||||||
static int VITA_GXM_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
static int VITA_GXM_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
|
|
||||||
SDL_FColor color = data->drawstate.color;
|
SDL_FColor color = data->drawstate.color;
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ static int VITA_GXM_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *c
|
||||||
|
|
||||||
static int VITA_GXM_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
static int VITA_GXM_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
SDL_FColor color = data->drawstate.color;
|
SDL_FColor color = data->drawstate.color;
|
||||||
|
|
||||||
color_vertex *vertex = (color_vertex *)pool_malloc(
|
color_vertex *vertex = (color_vertex *)pool_malloc(
|
||||||
|
@ -702,7 +702,7 @@ static int VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd
|
||||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||||
float scale_x, float scale_y)
|
float scale_x, float scale_y)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
int i;
|
int i;
|
||||||
int count = indices ? num_indices : num_vertices;
|
int count = indices ? num_indices : num_vertices;
|
||||||
const float color_scale = cmd->data.draw.color_scale;
|
const float color_scale = cmd->data.draw.color_scale;
|
||||||
|
@ -711,7 +711,7 @@ static int VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd
|
||||||
size_indices = indices ? size_indices : 0;
|
size_indices = indices ? size_indices : 0;
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
texture_vertex *vertices;
|
texture_vertex *vertices;
|
||||||
|
|
||||||
vertices = (texture_vertex *)pool_malloc(
|
vertices = (texture_vertex *)pool_malloc(
|
||||||
|
@ -801,7 +801,7 @@ static int VITA_GXM_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||||
void *color_buffer;
|
void *color_buffer;
|
||||||
SDL_FColor color;
|
SDL_FColor color;
|
||||||
|
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
unset_clip_rectangle(data);
|
unset_clip_rectangle(data);
|
||||||
|
|
||||||
// set clear shaders
|
// set clear shaders
|
||||||
|
@ -910,7 +910,7 @@ static int SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
if (texture != data->drawstate.texture) {
|
if (texture != data->drawstate.texture) {
|
||||||
if (texture) {
|
if (texture) {
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)cmd->data.draw.texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)cmd->data.draw.texture->internal;
|
||||||
sceGxmSetFragmentTexture(data->gxm_context, 0, &vita_texture->tex->gxm_tex);
|
sceGxmSetFragmentTexture(data->gxm_context, 0, &vita_texture->tex->gxm_tex);
|
||||||
}
|
}
|
||||||
data->drawstate.texture = texture;
|
data->drawstate.texture = texture;
|
||||||
|
@ -929,7 +929,7 @@ static void VITA_GXM_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
StartDrawing(renderer);
|
StartDrawing(renderer);
|
||||||
|
|
||||||
data->drawstate.target = renderer->target;
|
data->drawstate.target = renderer->target;
|
||||||
|
@ -1123,7 +1123,7 @@ static SDL_Surface *VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_
|
||||||
|
|
||||||
static int VITA_GXM_RenderPresent(SDL_Renderer *renderer)
|
static int VITA_GXM_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
SceCommonDialogUpdateParam updateParam;
|
SceCommonDialogUpdateParam updateParam;
|
||||||
|
|
||||||
data->displayData.address = data->displayBufferData[data->backBufferIndex];
|
data->displayData.address = data->displayBufferData[data->backBufferIndex];
|
||||||
|
@ -1165,8 +1165,8 @@ static int VITA_GXM_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
|
@ -1186,12 +1186,12 @@ static void VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture
|
||||||
|
|
||||||
SDL_free(vita_texture);
|
SDL_free(vita_texture);
|
||||||
|
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VITA_GXM_DestroyRenderer(SDL_Renderer *renderer)
|
static void VITA_GXM_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
if (data) {
|
if (data) {
|
||||||
if (!data->initialized) {
|
if (!data->initialized) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -374,7 +374,7 @@ int gxm_init(SDL_Renderer *renderer)
|
||||||
.colorMask = SCE_GXM_COLOR_MASK_ALL
|
.colorMask = SCE_GXM_COLOR_MASK_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
|
|
||||||
SceGxmInitializeParams initializeParams;
|
SceGxmInitializeParams initializeParams;
|
||||||
SDL_memset(&initializeParams, 0, sizeof(SceGxmInitializeParams));
|
SDL_memset(&initializeParams, 0, sizeof(SceGxmInitializeParams));
|
||||||
|
@ -858,7 +858,7 @@ int gxm_init(SDL_Renderer *renderer)
|
||||||
|
|
||||||
void gxm_finish(SDL_Renderer *renderer)
|
void gxm_finish(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||||
|
|
||||||
// wait until rendering is done
|
// wait until rendering is done
|
||||||
sceGxmFinish(data->gxm_context);
|
sceGxmFinish(data->gxm_context);
|
||||||
|
|
|
@ -459,7 +459,7 @@ static void VULKAN_DestroyAll(SDL_Renderer *renderer)
|
||||||
if (renderer == NULL) {
|
if (renderer == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
if (rendererData == NULL) {
|
if (rendererData == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -858,7 +858,7 @@ static void VULKAN_RecordPipelineImageBarrier(VULKAN_RenderData *rendererData, V
|
||||||
|
|
||||||
static VkResult VULKAN_AcquireNextSwapchainImage(SDL_Renderer *renderer)
|
static VkResult VULKAN_AcquireNextSwapchainImage(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = ( VULKAN_RenderData * )renderer->driverdata;
|
VULKAN_RenderData *rendererData = ( VULKAN_RenderData * )renderer->internal;
|
||||||
|
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ static void VULKAN_EnsureCommandBuffer(VULKAN_RenderData *rendererData)
|
||||||
|
|
||||||
static SDL_bool VULKAN_ActivateCommandBuffer(SDL_Renderer *renderer, VkAttachmentLoadOp loadOp, VkClearColorValue *clearColor, VULKAN_DrawStateCache *stateCache)
|
static SDL_bool VULKAN_ActivateCommandBuffer(SDL_Renderer *renderer, VkAttachmentLoadOp loadOp, VkClearColorValue *clearColor, VULKAN_DrawStateCache *stateCache)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
|
|
||||||
VULKAN_EnsureCommandBuffer(rendererData);
|
VULKAN_EnsureCommandBuffer(rendererData);
|
||||||
|
|
||||||
|
@ -1061,7 +1061,7 @@ static VkResult VULKAN_IssueBatch(VULKAN_RenderData *rendererData)
|
||||||
|
|
||||||
static void VULKAN_DestroyRenderer(SDL_Renderer *renderer)
|
static void VULKAN_DestroyRenderer(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
if (rendererData) {
|
if (rendererData) {
|
||||||
if (rendererData->device != VK_NULL_HANDLE) {
|
if (rendererData->device != VK_NULL_HANDLE) {
|
||||||
vkDeviceWaitIdle(rendererData->device);
|
vkDeviceWaitIdle(rendererData->device);
|
||||||
|
@ -1121,7 +1121,7 @@ static VkBlendOp GetBlendOp(SDL_BlendOperation operation)
|
||||||
static VULKAN_PipelineState *VULKAN_CreatePipelineState(SDL_Renderer *renderer,
|
static VULKAN_PipelineState *VULKAN_CreatePipelineState(SDL_Renderer *renderer,
|
||||||
VULKAN_Shader shader, VkPipelineLayout pipelineLayout, VkDescriptorSetLayout descriptorSetLayout, SDL_BlendMode blendMode, VkPrimitiveTopology topology, VkFormat format)
|
VULKAN_Shader shader, VkPipelineLayout pipelineLayout, VkDescriptorSetLayout descriptorSetLayout, SDL_BlendMode blendMode, VkPrimitiveTopology topology, VkFormat format)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_PipelineState *pipelineStates;
|
VULKAN_PipelineState *pipelineStates;
|
||||||
VkPipeline pipeline = VK_NULL_HANDLE;
|
VkPipeline pipeline = VK_NULL_HANDLE;
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
|
@ -1675,7 +1675,7 @@ static VkResult VULKAN_CreateDeviceResources(SDL_Renderer *renderer, SDL_Propert
|
||||||
VK_KHR_BIND_MEMORY_2_EXTENSION_NAME,
|
VK_KHR_BIND_MEMORY_2_EXTENSION_NAME,
|
||||||
VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
|
VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
|
||||||
};
|
};
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
|
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
|
||||||
|
@ -1949,7 +1949,7 @@ static VkResult VULKAN_CreateDeviceResources(SDL_Renderer *renderer, SDL_Propert
|
||||||
static VkResult VULKAN_CreateFramebuffersAndRenderPasses(SDL_Renderer *renderer, int w, int h,
|
static VkResult VULKAN_CreateFramebuffersAndRenderPasses(SDL_Renderer *renderer, int w, int h,
|
||||||
VkFormat format, int imageViewCount, VkImageView *imageViews, VkFramebuffer *framebuffers, VkRenderPass renderPasses[SDL_VULKAN_NUM_RENDERPASSES])
|
VkFormat format, int imageViewCount, VkImageView *imageViews, VkFramebuffer *framebuffers, VkRenderPass renderPasses[SDL_VULKAN_NUM_RENDERPASSES])
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *) renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *) renderer->internal;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
VkAttachmentDescription attachmentDescription = { 0 };
|
VkAttachmentDescription attachmentDescription = { 0 };
|
||||||
|
@ -2034,7 +2034,7 @@ static VkResult VULKAN_CreateFramebuffersAndRenderPasses(SDL_Renderer *renderer,
|
||||||
|
|
||||||
static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(rendererData->physicalDevice, rendererData->surface, &rendererData->surfaceCapabilities);
|
VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(rendererData->physicalDevice, rendererData->surface, &rendererData->surfaceCapabilities);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s\n", SDL_Vulkan_GetResultString(result));
|
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s\n", SDL_Vulkan_GetResultString(result));
|
||||||
|
@ -2419,7 +2419,7 @@ static VkResult VULKAN_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||||
/* Initialize all resources that change when the window's size changes. */
|
/* Initialize all resources that change when the window's size changes. */
|
||||||
static VkResult VULKAN_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
static VkResult VULKAN_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
|
@ -2445,7 +2445,7 @@ static VkResult VULKAN_CreateWindowSizeDependentResources(SDL_Renderer *renderer
|
||||||
/* This method is called when the window's size changes. */
|
/* This method is called when the window's size changes. */
|
||||||
static VkResult VULKAN_UpdateForWindowSizeChange(SDL_Renderer *renderer)
|
static VkResult VULKAN_UpdateForWindowSizeChange(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
/* If the GPU has previous work, wait for it to be done first */
|
/* If the GPU has previous work, wait for it to be done first */
|
||||||
VULKAN_WaitForGPU(rendererData);
|
VULKAN_WaitForGPU(rendererData);
|
||||||
|
|
||||||
|
@ -2454,7 +2454,7 @@ static VkResult VULKAN_UpdateForWindowSizeChange(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static void VULKAN_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
static void VULKAN_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
|
||||||
rendererData->recreateSwapchain = SDL_TRUE;
|
rendererData->recreateSwapchain = SDL_TRUE;
|
||||||
|
@ -2483,7 +2483,7 @@ static SDL_bool VULKAN_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode b
|
||||||
|
|
||||||
static int VULKAN_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
static int VULKAN_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData;
|
VULKAN_TextureData *textureData;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
VkFormat textureFormat = SDLPixelFormatToVkTextureFormat(texture->format, renderer->output_colorspace);
|
VkFormat textureFormat = SDLPixelFormatToVkTextureFormat(texture->format, renderer->output_colorspace);
|
||||||
|
@ -2498,7 +2498,7 @@ static int VULKAN_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
texture->driverdata = textureData;
|
texture->internal = textureData;
|
||||||
if (SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
|
if (SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
|
||||||
textureData->shader = SHADER_RGB;
|
textureData->shader = SHADER_RGB;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2665,8 +2665,8 @@ static int VULKAN_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
|
||||||
static void VULKAN_DestroyTexture(SDL_Renderer *renderer,
|
static void VULKAN_DestroyTexture(SDL_Renderer *renderer,
|
||||||
SDL_Texture *texture)
|
SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -2711,7 +2711,7 @@ static void VULKAN_DestroyTexture(SDL_Renderer *renderer,
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(textureData);
|
SDL_free(textureData);
|
||||||
texture->driverdata = NULL;
|
texture->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkResult VULKAN_UpdateTextureInternal(VULKAN_RenderData *rendererData, VkImage image, VkFormat format, int plane, int x, int y, int w, int h, const void *pixels, int pitch, VkImageLayout *imageLayout)
|
static VkResult VULKAN_UpdateTextureInternal(VULKAN_RenderData *rendererData, VkImage image, VkFormat format, int plane, int x, int y, int w, int h, const void *pixels, int pitch, VkImageLayout *imageLayout)
|
||||||
|
@ -2811,8 +2811,8 @@ static int VULKAN_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, const void *srcPixels,
|
const SDL_Rect *rect, const void *srcPixels,
|
||||||
int srcPitch)
|
int srcPitch)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2860,8 +2860,8 @@ static int VULKAN_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Uplane, int Upitch,
|
const Uint8 *Uplane, int Upitch,
|
||||||
const Uint8 *Vplane, int Vpitch)
|
const Uint8 *Vplane, int Vpitch)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2884,8 +2884,8 @@ static int VULKAN_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const Uint8 *Yplane, int Ypitch,
|
const Uint8 *Yplane, int Ypitch,
|
||||||
const Uint8 *UVplane, int UVpitch)
|
const Uint8 *UVplane, int UVpitch)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2905,8 +2905,8 @@ static int VULKAN_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
static int VULKAN_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
static int VULKAN_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
const SDL_Rect *rect, void **pixels, int *pitch)
|
const SDL_Rect *rect, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return SDL_SetError("Texture is not currently available");
|
return SDL_SetError("Texture is not currently available");
|
||||||
|
@ -2946,8 +2946,8 @@ static int VULKAN_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
static void VULKAN_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
static void VULKAN_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -2999,7 +2999,7 @@ static void VULKAN_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
static void VULKAN_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
static void VULKAN_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
{
|
{
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (!textureData) {
|
if (!textureData) {
|
||||||
return;
|
return;
|
||||||
|
@ -3010,7 +3010,7 @@ static void VULKAN_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *text
|
||||||
|
|
||||||
static int VULKAN_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
static int VULKAN_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = NULL;
|
VULKAN_TextureData *textureData = NULL;
|
||||||
|
|
||||||
VULKAN_EnsureCommandBuffer(rendererData);
|
VULKAN_EnsureCommandBuffer(rendererData);
|
||||||
|
@ -3031,7 +3031,7 @@ static int VULKAN_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
textureData = (VULKAN_TextureData *)texture->driverdata;
|
textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
|
|
||||||
if (textureData->mainImage.imageView == VK_NULL_HANDLE) {
|
if (textureData->mainImage.imageView == VK_NULL_HANDLE) {
|
||||||
return SDL_SetError("specified texture is not a render target");
|
return SDL_SetError("specified texture is not a render target");
|
||||||
|
@ -3089,7 +3089,7 @@ static int VULKAN_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||||
int count = indices ? num_indices : num_vertices;
|
int count = indices ? num_indices : num_vertices;
|
||||||
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
||||||
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
|
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
|
||||||
VULKAN_TextureData *textureData = texture ? (VULKAN_TextureData *)texture->driverdata : NULL;
|
VULKAN_TextureData *textureData = texture ? (VULKAN_TextureData *)texture->internal : NULL;
|
||||||
float u_scale = textureData ? (float)texture->w / textureData->width : 0.0f;
|
float u_scale = textureData ? (float)texture->w / textureData->width : 0.0f;
|
||||||
float v_scale = textureData ? (float)texture->h / textureData->height : 0.0f;
|
float v_scale = textureData ? (float)texture->h / textureData->height : 0.0f;
|
||||||
|
|
||||||
|
@ -3139,7 +3139,7 @@ static int VULKAN_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||||
static SDL_bool VULKAN_UpdateVertexBuffer(SDL_Renderer *renderer,
|
static SDL_bool VULKAN_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
const void *vertexData, size_t dataSizeInBytes, VULKAN_DrawStateCache *stateCache)
|
const void *vertexData, size_t dataSizeInBytes, VULKAN_DrawStateCache *stateCache)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
const int vbidx = rendererData->currentVertexBuffer;
|
const int vbidx = rendererData->currentVertexBuffer;
|
||||||
VULKAN_Buffer *vertexBuffer;
|
VULKAN_Buffer *vertexBuffer;
|
||||||
|
|
||||||
|
@ -3176,7 +3176,7 @@ static SDL_bool VULKAN_UpdateVertexBuffer(SDL_Renderer *renderer,
|
||||||
|
|
||||||
static int VULKAN_UpdateViewport(SDL_Renderer *renderer)
|
static int VULKAN_UpdateViewport(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
const SDL_Rect *viewport = &rendererData->currentViewport;
|
const SDL_Rect *viewport = &rendererData->currentViewport;
|
||||||
Float4X4 projection;
|
Float4X4 projection;
|
||||||
Float4X4 view;
|
Float4X4 view;
|
||||||
|
@ -3220,7 +3220,7 @@ static int VULKAN_UpdateViewport(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int VULKAN_UpdateClipRect(SDL_Renderer *renderer)
|
static int VULKAN_UpdateClipRect(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
const SDL_Rect *viewport = &rendererData->currentViewport;
|
const SDL_Rect *viewport = &rendererData->currentViewport;
|
||||||
|
|
||||||
VkRect2D scissor;
|
VkRect2D scissor;
|
||||||
|
@ -3372,7 +3372,7 @@ static VkResult VULKAN_CreateDescriptorSetAndPipelineLayout(VULKAN_RenderData *r
|
||||||
static VkDescriptorSet VULKAN_AllocateDescriptorSet(SDL_Renderer *renderer, VULKAN_Shader shader, VkDescriptorSetLayout descriptorSetLayout,
|
static VkDescriptorSet VULKAN_AllocateDescriptorSet(SDL_Renderer *renderer, VULKAN_Shader shader, VkDescriptorSetLayout descriptorSetLayout,
|
||||||
VkSampler sampler, VkBuffer constantBuffer, VkDeviceSize constantBufferOffset, VkImageView imageView)
|
VkSampler sampler, VkBuffer constantBuffer, VkDeviceSize constantBufferOffset, VkImageView imageView)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
uint32_t currentDescriptorPoolIndex = rendererData->currentDescriptorPoolIndex;
|
uint32_t currentDescriptorPoolIndex = rendererData->currentDescriptorPoolIndex;
|
||||||
VkDescriptorPool descriptorPool = rendererData->descriptorPools[rendererData->currentCommandBufferIndex][currentDescriptorPoolIndex];
|
VkDescriptorPool descriptorPool = rendererData->descriptorPools[rendererData->currentCommandBufferIndex][currentDescriptorPoolIndex];
|
||||||
|
|
||||||
|
@ -3468,7 +3468,7 @@ static SDL_bool VULKAN_SetDrawState(SDL_Renderer *renderer, const SDL_RenderComm
|
||||||
const PixelShaderConstants *shader_constants, VkPrimitiveTopology topology, VkImageView imageView, VkSampler sampler, const Float4X4 *matrix, VULKAN_DrawStateCache *stateCache)
|
const PixelShaderConstants *shader_constants, VkPrimitiveTopology topology, VkImageView imageView, VkSampler sampler, const Float4X4 *matrix, VULKAN_DrawStateCache *stateCache)
|
||||||
|
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
const SDL_BlendMode blendMode = cmd->data.draw.blend;
|
const SDL_BlendMode blendMode = cmd->data.draw.blend;
|
||||||
VkFormat format = rendererData->surfaceFormat.format;
|
VkFormat format = rendererData->surfaceFormat.format;
|
||||||
const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity;
|
const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity;
|
||||||
|
@ -3616,8 +3616,8 @@ static SDL_bool VULKAN_SetDrawState(SDL_Renderer *renderer, const SDL_RenderComm
|
||||||
static SDL_bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix, VULKAN_DrawStateCache *stateCache)
|
static SDL_bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix, VULKAN_DrawStateCache *stateCache)
|
||||||
{
|
{
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->driverdata;
|
VULKAN_TextureData *textureData = (VULKAN_TextureData *)texture->internal;
|
||||||
VkSampler textureSampler = VK_NULL_HANDLE;
|
VkSampler textureSampler = VK_NULL_HANDLE;
|
||||||
PixelShaderConstants constants;
|
PixelShaderConstants constants;
|
||||||
VkDescriptorSetLayout descriptorSetLayout = (textureData->descriptorSetLayoutYcbcr != VK_NULL_HANDLE) ? textureData->descriptorSetLayoutYcbcr : rendererData->descriptorSetLayout;
|
VkDescriptorSetLayout descriptorSetLayout = (textureData->descriptorSetLayoutYcbcr != VK_NULL_HANDLE) ? textureData->descriptorSetLayoutYcbcr : rendererData->descriptorSetLayout;
|
||||||
|
@ -3663,20 +3663,20 @@ static SDL_bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderComm
|
||||||
|
|
||||||
static void VULKAN_DrawPrimitives(SDL_Renderer *renderer, VkPrimitiveTopology primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
static void VULKAN_DrawPrimitives(SDL_Renderer *renderer, VkPrimitiveTopology primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
vkCmdDraw(rendererData->currentCommandBuffer, (uint32_t)vertexCount, 1, (uint32_t)vertexStart, 0);
|
vkCmdDraw(rendererData->currentCommandBuffer, (uint32_t)vertexCount, 1, (uint32_t)vertexStart, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_InvalidateCachedState(SDL_Renderer *renderer)
|
static void VULKAN_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
rendererData->currentPipelineState = NULL;
|
rendererData->currentPipelineState = NULL;
|
||||||
rendererData->cliprectDirty = SDL_TRUE;
|
rendererData->cliprectDirty = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int VULKAN_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
static int VULKAN_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VULKAN_DrawStateCache stateCache;
|
VULKAN_DrawStateCache stateCache;
|
||||||
SDL_memset(&stateCache, 0, sizeof(stateCache));
|
SDL_memset(&stateCache, 0, sizeof(stateCache));
|
||||||
|
|
||||||
|
@ -3805,7 +3805,7 @@ static int VULKAN_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd
|
||||||
|
|
||||||
static SDL_Surface* VULKAN_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
static SDL_Surface* VULKAN_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VkImage backBuffer;
|
VkImage backBuffer;
|
||||||
VkImageLayout *imageLayout;
|
VkImageLayout *imageLayout;
|
||||||
VULKAN_Buffer readbackBuffer;
|
VULKAN_Buffer readbackBuffer;
|
||||||
|
@ -3901,7 +3901,7 @@ static SDL_Surface* VULKAN_RenderReadPixels(SDL_Renderer *renderer, const SDL_Re
|
||||||
|
|
||||||
static int VULKAN_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
|
static int VULKAN_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
|
|
||||||
if (wait_semaphore) {
|
if (wait_semaphore) {
|
||||||
if (rendererData->waitRenderSemaphoreCount == rendererData->waitRenderSemaphoreMax) {
|
if (rendererData->waitRenderSemaphoreCount == rendererData->waitRenderSemaphoreMax) {
|
||||||
|
@ -3943,7 +3943,7 @@ static int VULKAN_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_
|
||||||
|
|
||||||
static int VULKAN_RenderPresent(SDL_Renderer *renderer)
|
static int VULKAN_RenderPresent(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
if (rendererData->currentCommandBuffer) {
|
if (rendererData->currentCommandBuffer) {
|
||||||
|
|
||||||
|
@ -4035,7 +4035,7 @@ static int VULKAN_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
|
||||||
static int VULKAN_SetVSync(SDL_Renderer *renderer, const int vsync)
|
static int VULKAN_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||||
|
|
||||||
switch (vsync) {
|
switch (vsync) {
|
||||||
case -1:
|
case -1:
|
||||||
|
@ -4101,7 +4101,7 @@ static int VULKAN_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL
|
||||||
renderer->DestroyTexture = VULKAN_DestroyTexture;
|
renderer->DestroyTexture = VULKAN_DestroyTexture;
|
||||||
renderer->DestroyRenderer = VULKAN_DestroyRenderer;
|
renderer->DestroyRenderer = VULKAN_DestroyRenderer;
|
||||||
renderer->SetVSync = VULKAN_SetVSync;
|
renderer->SetVSync = VULKAN_SetVSync;
|
||||||
renderer->driverdata = rendererData;
|
renderer->internal = rendererData;
|
||||||
VULKAN_InvalidateCachedState(renderer);
|
VULKAN_InvalidateCachedState(renderer);
|
||||||
|
|
||||||
renderer->name = VULKAN_RenderDriver.name;
|
renderer->name = VULKAN_RenderDriver.name;
|
||||||
|
|
|
@ -150,19 +150,19 @@ extern int SDL_EGL_SetErrorEx(const char *message, const char *eglFunctionName,
|
||||||
#define SDL_EGL_SwapWindow_impl(BACKEND) \
|
#define SDL_EGL_SwapWindow_impl(BACKEND) \
|
||||||
int BACKEND##_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window) \
|
int BACKEND##_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window) \
|
||||||
{ \
|
{ \
|
||||||
return SDL_EGL_SwapBuffers(_this, window->driverdata->egl_surface); \
|
return SDL_EGL_SwapBuffers(_this, window->internal->egl_surface); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDL_EGL_MakeCurrent_impl(BACKEND) \
|
#define SDL_EGL_MakeCurrent_impl(BACKEND) \
|
||||||
int BACKEND##_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context) \
|
int BACKEND##_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context) \
|
||||||
{ \
|
{ \
|
||||||
return SDL_EGL_MakeCurrent(_this, window ? window->driverdata->egl_surface : EGL_NO_SURFACE, context); \
|
return SDL_EGL_MakeCurrent(_this, window ? window->internal->egl_surface : EGL_NO_SURFACE, context); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDL_EGL_CreateContext_impl(BACKEND) \
|
#define SDL_EGL_CreateContext_impl(BACKEND) \
|
||||||
SDL_GLContext BACKEND##_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window) \
|
SDL_GLContext BACKEND##_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window) \
|
||||||
{ \
|
{ \
|
||||||
return SDL_EGL_CreateContext(_this, window->driverdata->egl_surface); \
|
return SDL_EGL_CreateContext(_this, window->internal->egl_surface); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_OPENGL_EGL */
|
#endif /* SDL_VIDEO_OPENGL_EGL */
|
||||||
|
|
|
@ -112,7 +112,7 @@ struct SDL_Window
|
||||||
|
|
||||||
SDL_PropertiesID props;
|
SDL_PropertiesID props;
|
||||||
|
|
||||||
SDL_WindowData *driverdata;
|
SDL_WindowData *internal;
|
||||||
|
|
||||||
SDL_Window *prev;
|
SDL_Window *prev;
|
||||||
SDL_Window *next;
|
SDL_Window *next;
|
||||||
|
@ -154,7 +154,7 @@ struct SDL_VideoDisplay
|
||||||
|
|
||||||
SDL_PropertiesID props;
|
SDL_PropertiesID props;
|
||||||
|
|
||||||
SDL_DisplayData *driverdata;
|
SDL_DisplayData *internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Video device flags */
|
/* Video device flags */
|
||||||
|
@ -456,7 +456,7 @@ struct SDL_VideoDevice
|
||||||
|
|
||||||
/* * * */
|
/* * * */
|
||||||
/* Data private to this driver */
|
/* Data private to this driver */
|
||||||
SDL_VideoData *driverdata;
|
SDL_VideoData *internal;
|
||||||
struct SDL_GLDriverData *gl_data;
|
struct SDL_GLDriverData *gl_data;
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||||
|
|
|
@ -836,10 +836,10 @@ void SDL_DelVideoDisplay(SDL_DisplayID displayID, SDL_bool send_event)
|
||||||
SDL_DestroyProperties(display->props);
|
SDL_DestroyProperties(display->props);
|
||||||
SDL_free(display->name);
|
SDL_free(display->name);
|
||||||
SDL_ResetFullscreenDisplayModes(display);
|
SDL_ResetFullscreenDisplayModes(display);
|
||||||
SDL_free(display->desktop_mode.driverdata);
|
SDL_free(display->desktop_mode.internal);
|
||||||
display->desktop_mode.driverdata = NULL;
|
display->desktop_mode.internal = NULL;
|
||||||
SDL_free(display->driverdata);
|
SDL_free(display->internal);
|
||||||
display->driverdata = NULL;
|
display->internal = NULL;
|
||||||
SDL_free(display);
|
SDL_free(display);
|
||||||
|
|
||||||
if (display_index < (_this->num_displays - 1)) {
|
if (display_index < (_this->num_displays - 1)) {
|
||||||
|
@ -929,7 +929,7 @@ SDL_DisplayData *SDL_GetDisplayDriverData(SDL_DisplayID displayID)
|
||||||
|
|
||||||
CHECK_DISPLAY_MAGIC(display, NULL);
|
CHECK_DISPLAY_MAGIC(display, NULL);
|
||||||
|
|
||||||
return display->driverdata;
|
return display->internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DisplayData *SDL_GetDisplayDriverDataForWindow(SDL_Window *window)
|
SDL_DisplayData *SDL_GetDisplayDriverDataForWindow(SDL_Window *window)
|
||||||
|
@ -1213,8 +1213,8 @@ void SDL_ResetFullscreenDisplayModes(SDL_VideoDisplay *display)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = display->num_fullscreen_modes; i--;) {
|
for (i = display->num_fullscreen_modes; i--;) {
|
||||||
SDL_free(display->fullscreen_modes[i].driverdata);
|
SDL_free(display->fullscreen_modes[i].internal);
|
||||||
display->fullscreen_modes[i].driverdata = NULL;
|
display->fullscreen_modes[i].internal = NULL;
|
||||||
}
|
}
|
||||||
SDL_free(display->fullscreen_modes);
|
SDL_free(display->fullscreen_modes);
|
||||||
display->fullscreen_modes = NULL;
|
display->fullscreen_modes = NULL;
|
||||||
|
@ -1332,8 +1332,8 @@ void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode
|
||||||
|
|
||||||
SDL_copyp(&last_mode, &display->desktop_mode);
|
SDL_copyp(&last_mode, &display->desktop_mode);
|
||||||
|
|
||||||
if (display->desktop_mode.driverdata) {
|
if (display->desktop_mode.internal) {
|
||||||
SDL_free(display->desktop_mode.driverdata);
|
SDL_free(display->desktop_mode.internal);
|
||||||
}
|
}
|
||||||
SDL_copyp(&display->desktop_mode, mode);
|
SDL_copyp(&display->desktop_mode, mode);
|
||||||
display->desktop_mode.displayID = display->id;
|
display->desktop_mode.displayID = display->id;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void android_egl_context_restore(SDL_Window *window)
|
||||||
{
|
{
|
||||||
if (window) {
|
if (window) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
SDL_GL_MakeCurrent(window, NULL);
|
SDL_GL_MakeCurrent(window, NULL);
|
||||||
if (SDL_GL_MakeCurrent(window, (SDL_GLContext)data->egl_context) < 0) {
|
if (SDL_GL_MakeCurrent(window, (SDL_GLContext)data->egl_context) < 0) {
|
||||||
/* The context is no longer valid, create a new one */
|
/* The context is no longer valid, create a new one */
|
||||||
|
@ -68,7 +68,7 @@ static void android_egl_context_backup(SDL_Window *window)
|
||||||
if (window) {
|
if (window) {
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
/* Keep a copy of the EGL Context so we can try to restore it when we resume */
|
/* Keep a copy of the EGL Context so we can try to restore it when we resume */
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
data->egl_context = SDL_GL_GetCurrentContext();
|
data->egl_context = SDL_GL_GetCurrentContext();
|
||||||
|
|
||||||
/* Save/Restore the swap interval / vsync */
|
/* Save/Restore the swap interval / vsync */
|
||||||
|
@ -93,7 +93,7 @@ static void android_egl_context_backup(SDL_Window *window)
|
||||||
|
|
||||||
void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
|
void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
|
|
||||||
if (videodata->isPaused) {
|
if (videodata->isPaused) {
|
||||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||||
|
@ -162,7 +162,7 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
|
void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
static int backup_context = 0;
|
static int backup_context = 0;
|
||||||
|
|
||||||
if (videodata->isPaused) {
|
if (videodata->isPaused) {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
int Android_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
int Android_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
if (window && context) {
|
if (window && context) {
|
||||||
return SDL_EGL_MakeCurrent(_this, window->driverdata->egl_surface, context);
|
return SDL_EGL_MakeCurrent(_this, window->internal->egl_surface, context);
|
||||||
} else {
|
} else {
|
||||||
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ SDL_GLContext Android_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *win
|
||||||
|
|
||||||
Android_ActivityMutex_Lock_Running();
|
Android_ActivityMutex_Lock_Running();
|
||||||
|
|
||||||
ret = SDL_EGL_CreateContext(_this, window->driverdata->egl_surface);
|
ret = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
|
||||||
|
|
||||||
SDL_UnlockMutex(Android_ActivityMutex);
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ int Android_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
/*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
|
/*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
|
||||||
_this->egl_data->eglWaitGL();*/
|
_this->egl_data->eglWaitGL();*/
|
||||||
retval = SDL_EGL_SwapBuffers(_this, window->driverdata->egl_surface);
|
retval = SDL_EGL_SwapBuffers(_this, window->internal->egl_surface);
|
||||||
|
|
||||||
SDL_UnlockMutex(Android_ActivityMutex);
|
SDL_UnlockMutex(Android_ActivityMutex);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ static SDL_Cursor *Android_WrapCursor(int custom_cursor, int system_cursor)
|
||||||
if (data) {
|
if (data) {
|
||||||
data->custom_cursor = custom_cursor;
|
data->custom_cursor = custom_cursor;
|
||||||
data->system_cursor = system_cursor;
|
data->system_cursor = system_cursor;
|
||||||
cursor->driverdata = data;
|
cursor->internal = data;
|
||||||
} else {
|
} else {
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
cursor = NULL;
|
cursor = NULL;
|
||||||
|
@ -104,11 +104,11 @@ static SDL_Cursor *Android_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
|
|
||||||
static void Android_FreeCursor(SDL_Cursor *cursor)
|
static void Android_FreeCursor(SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->driverdata;
|
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->internal;
|
||||||
if (data->custom_cursor != 0) {
|
if (data->custom_cursor != 0) {
|
||||||
Android_JNI_DestroyCustomCursor(data->custom_cursor);
|
Android_JNI_DestroyCustomCursor(data->custom_cursor);
|
||||||
}
|
}
|
||||||
SDL_free(cursor->driverdata);
|
SDL_free(cursor->internal);
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ static int Android_ShowCursor(SDL_Cursor *cursor)
|
||||||
cursor = Android_CreateEmptyCursor();
|
cursor = Android_CreateEmptyCursor();
|
||||||
}
|
}
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->driverdata;
|
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->internal;
|
||||||
if (data->custom_cursor) {
|
if (data->custom_cursor) {
|
||||||
if (!Android_JNI_SetCustomCursor(data->custom_cursor)) {
|
if (!Android_JNI_SetCustomCursor(data->custom_cursor)) {
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
|
|
|
@ -75,7 +75,7 @@ static int Android_SuspendScreenSaver(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
static void Android_DeleteDevice(SDL_VideoDevice *device)
|
static void Android_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static SDL_VideoDevice *Android_CreateDevice(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = data;
|
device->internal = data;
|
||||||
device->system_theme = Android_SystemTheme;
|
device->system_theme = Android_SystemTheme;
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -167,7 +167,7 @@ VideoBootStrap Android_bootstrap = {
|
||||||
|
|
||||||
int Android_VideoInit(SDL_VideoDevice *_this)
|
int Android_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
SDL_DisplayID displayID;
|
SDL_DisplayID displayID;
|
||||||
SDL_VideoDisplay *display;
|
SDL_VideoDisplay *display;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
@ -181,7 +181,6 @@ int Android_VideoInit(SDL_VideoDevice *_this)
|
||||||
mode.w = Android_DeviceWidth;
|
mode.w = Android_DeviceWidth;
|
||||||
mode.h = Android_DeviceHeight;
|
mode.h = Android_DeviceHeight;
|
||||||
mode.refresh_rate = Android_ScreenRate;
|
mode.refresh_rate = Android_ScreenRate;
|
||||||
mode.driverdata = NULL;
|
|
||||||
|
|
||||||
displayID = SDL_AddBasicVideoDisplay(&mode);
|
displayID = SDL_AddBasicVideoDisplay(&mode);
|
||||||
if (displayID == 0) {
|
if (displayID == 0) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ int Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
const struct VkAllocationCallbacks *allocator,
|
const struct VkAllocationCallbacks *allocator,
|
||||||
VkSurfaceKHR *surface)
|
VkSurfaceKHR *surface)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windowData = window->driverdata;
|
SDL_WindowData *windowData = window->internal;
|
||||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||||
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
|
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
|
||||||
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR =
|
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR =
|
||||||
|
|
|
@ -90,7 +90,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
|
||||||
SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface);
|
SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->driverdata = data;
|
window->internal = data;
|
||||||
Android_Window = window;
|
Android_Window = window;
|
||||||
|
|
||||||
endfunction:
|
endfunction:
|
||||||
|
@ -128,7 +128,7 @@ int Android_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_
|
||||||
goto endfunction;
|
goto endfunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
if (!data || !data->native_window) {
|
if (!data || !data->native_window) {
|
||||||
if (data && !data->native_window) {
|
if (data && !data->native_window) {
|
||||||
SDL_SetError("Missing native window");
|
SDL_SetError("Missing native window");
|
||||||
|
@ -175,8 +175,8 @@ void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
if (window == Android_Window) {
|
if (window == Android_Window) {
|
||||||
Android_Window = NULL;
|
Android_Window = NULL;
|
||||||
|
|
||||||
if (window->driverdata) {
|
if (window->internal) {
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||||
if (data->egl_surface != EGL_NO_SURFACE) {
|
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||||
|
@ -187,8 +187,8 @@ void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
if (data->native_window) {
|
if (data->native_window) {
|
||||||
ANativeWindow_release(data->native_window);
|
ANativeWindow_release(data->native_window);
|
||||||
}
|
}
|
||||||
SDL_free(window->driverdata);
|
SDL_free(window->internal);
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void Cocoa_CheckClipboardUpdate(SDL_CocoaVideoData *data)
|
||||||
int Cocoa_SetClipboardData(SDL_VideoDevice *_this)
|
int Cocoa_SetClipboardData(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
||||||
NSPasteboardItem *newItem = [NSPasteboardItem new];
|
NSPasteboardItem *newItem = [NSPasteboardItem new];
|
||||||
NSMutableArray *utiTypes = [NSMutableArray new];
|
NSMutableArray *utiTypes = [NSMutableArray new];
|
||||||
|
|
|
@ -35,7 +35,7 @@ static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win)
|
||||||
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
||||||
if (device && device->windows) {
|
if (device && device->windows) {
|
||||||
for (sdlwindow = device->windows; sdlwindow; sdlwindow = sdlwindow->next) {
|
for (sdlwindow = device->windows; sdlwindow; sdlwindow = sdlwindow->next) {
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)sdlwindow->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)sdlwindow->internal).nswindow;
|
||||||
if (win == nswindow) {
|
if (win == nswindow) {
|
||||||
return sdlwindow;
|
return sdlwindow;
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ int Cocoa_PumpEventsUntilDate(SDL_VideoDevice *_this, NSDate *expiration, bool a
|
||||||
{
|
{
|
||||||
/* Run any existing modal sessions. */
|
/* Run any existing modal sessions. */
|
||||||
for (SDL_Window *w = _this->windows; w; w = w->next) {
|
for (SDL_Window *w = _this->windows; w; w = w->next) {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)w->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)w->internal;
|
||||||
if (data.modal_session) {
|
if (data.modal_session) {
|
||||||
[NSApp runModalSession:data.modal_session];
|
[NSApp runModalSession:data.modal_session];
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ void Cocoa_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
location:NSMakePoint(0, 0)
|
location:NSMakePoint(0, 0)
|
||||||
modifierFlags:0
|
modifierFlags:0
|
||||||
timestamp:0.0
|
timestamp:0.0
|
||||||
windowNumber:((__bridge SDL_CocoaWindowData *)window->driverdata).window_number
|
windowNumber:((__bridge SDL_CocoaWindowData *)window->internal).window_number
|
||||||
context:nil
|
context:nil
|
||||||
subtype:0
|
subtype:0
|
||||||
data1:0
|
data1:0
|
||||||
|
@ -633,7 +633,7 @@ void Cocoa_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
int Cocoa_SuspendScreenSaver(SDL_VideoDevice *_this)
|
int Cocoa_SuspendScreenSaver(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
|
|
||||||
if (data.screensaver_assertion) {
|
if (data.screensaver_assertion) {
|
||||||
IOPMAssertionRelease(data.screensaver_assertion);
|
IOPMAssertionRelease(data.screensaver_assertion);
|
||||||
|
|
|
@ -328,7 +328,7 @@ static void UpdateKeymap(SDL_CocoaVideoData *data, SDL_bool send_event)
|
||||||
|
|
||||||
void Cocoa_InitKeyboard(SDL_VideoDevice *_this)
|
void Cocoa_InitKeyboard(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
|
|
||||||
UpdateKeymap(data, SDL_FALSE);
|
UpdateKeymap(data, SDL_FALSE);
|
||||||
|
|
||||||
|
@ -348,8 +348,8 @@ int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSView *parentView;
|
NSView *parentView;
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->internal).nswindow;
|
||||||
|
|
||||||
parentView = [nswindow contentView];
|
parentView = [nswindow contentView];
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
int Cocoa_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
int Cocoa_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
|
|
||||||
if (data && data.fieldEdit) {
|
if (data && data.fieldEdit) {
|
||||||
[data.fieldEdit removeFromSuperview];
|
[data.fieldEdit removeFromSuperview];
|
||||||
|
@ -387,7 +387,7 @@ int Cocoa_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
int Cocoa_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window)
|
int Cocoa_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
if (data.fieldEdit) {
|
if (data.fieldEdit) {
|
||||||
[data.fieldEdit setInputRect:&window->text_input_rect];
|
[data.fieldEdit setInputRect:&window->text_input_rect];
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event)
|
||||||
{
|
{
|
||||||
unsigned short scancode;
|
unsigned short scancode;
|
||||||
SDL_Scancode code;
|
SDL_Scancode code;
|
||||||
SDL_CocoaVideoData *data = _this ? ((__bridge SDL_CocoaVideoData *)_this->driverdata) : nil;
|
SDL_CocoaVideoData *data = _this ? ((__bridge SDL_CocoaVideoData *)_this->internal) : nil;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return; /* can happen when returning from fullscreen Space on shutdown */
|
return; /* can happen when returning from fullscreen Space on shutdown */
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
/* Retain the NSWindow because we'll show the alert later on the main thread */
|
/* Retain the NSWindow because we'll show the alert later on the main thread */
|
||||||
if (window) {
|
if (window) {
|
||||||
nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
nswindow = ((__bridge SDL_CocoaWindowData *)window->internal).nswindow;
|
||||||
} else {
|
} else {
|
||||||
nswindow = nil;
|
nswindow = nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
|
||||||
SDL_MetalView Cocoa_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_MetalView Cocoa_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSView *view = data.nswindow.contentView;
|
NSView *view = data.nswindow.contentView;
|
||||||
BOOL highDPI = (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) != 0;
|
BOOL highDPI = (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) != 0;
|
||||||
BOOL opaque = (window->flags & SDL_WINDOW_TRANSPARENT) == 0;
|
BOOL opaque = (window->flags & SDL_WINDOW_TRANSPARENT) == 0;
|
||||||
|
|
|
@ -271,7 +271,7 @@ static SDL_bool GetDisplayMode(SDL_VideoDevice *_this, CGDisplayModeRef vidmode,
|
||||||
mode->h = (int)height;
|
mode->h = (int)height;
|
||||||
mode->pixel_density = (float)pixelW / width;
|
mode->pixel_density = (float)pixelW / width;
|
||||||
mode->refresh_rate = refreshrate;
|
mode->refresh_rate = refreshrate;
|
||||||
mode->driverdata = data;
|
mode->internal = data;
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ void Cocoa_InitModes(SDL_VideoDevice *_this)
|
||||||
Cocoa_GetHDRProperties(displaydata->display, &display.HDR);
|
Cocoa_GetHDRProperties(displaydata->display, &display.HDR);
|
||||||
|
|
||||||
display.desktop_mode = mode;
|
display.desktop_mode = mode;
|
||||||
display.driverdata = displaydata;
|
display.internal = displaydata;
|
||||||
SDL_AddVideoDisplay(&display, SDL_FALSE);
|
SDL_AddVideoDisplay(&display, SDL_FALSE);
|
||||||
SDL_free(display.name);
|
SDL_free(display.name);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ void Cocoa_UpdateDisplays(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
for (i = 0; i < _this->num_displays; ++i) {
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
SDL_VideoDisplay *display = _this->displays[i];
|
SDL_VideoDisplay *display = _this->displays[i];
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
|
||||||
|
|
||||||
Cocoa_GetHDRProperties(displaydata->display, &HDR);
|
Cocoa_GetHDRProperties(displaydata->display, &HDR);
|
||||||
SDL_SetDisplayHDRProperties(display, &HDR);
|
SDL_SetDisplayHDRProperties(display, &HDR);
|
||||||
|
@ -411,7 +411,7 @@ void Cocoa_UpdateDisplays(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
int Cocoa_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
int Cocoa_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
|
||||||
CGRect cgrect;
|
CGRect cgrect;
|
||||||
|
|
||||||
cgrect = CGDisplayBounds(displaydata->display);
|
cgrect = CGDisplayBounds(displaydata->display);
|
||||||
|
@ -424,7 +424,7 @@ int Cocoa_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SD
|
||||||
|
|
||||||
int Cocoa_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
int Cocoa_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
|
||||||
NSScreen *screen = GetNSScreenForDisplayID(displaydata->display);
|
NSScreen *screen = GetNSScreenForDisplayID(displaydata->display);
|
||||||
|
|
||||||
if (screen == nil) {
|
if (screen == nil) {
|
||||||
|
@ -444,7 +444,7 @@ int Cocoa_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *displ
|
||||||
|
|
||||||
int Cocoa_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
int Cocoa_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *)display->internal;
|
||||||
CVDisplayLinkRef link = NULL;
|
CVDisplayLinkRef link = NULL;
|
||||||
CFArrayRef modes;
|
CFArrayRef modes;
|
||||||
CFDictionaryRef dict = NULL;
|
CFDictionaryRef dict = NULL;
|
||||||
|
@ -488,8 +488,8 @@ int Cocoa_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
|
|
||||||
if (GetDisplayMode(_this, moderef, SDL_FALSE, modes, link, &mode)) {
|
if (GetDisplayMode(_this, moderef, SDL_FALSE, modes, link, &mode)) {
|
||||||
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
||||||
CFRelease(((SDL_DisplayModeData *)mode.driverdata)->modes);
|
CFRelease(mode.internal->modes);
|
||||||
SDL_free(mode.driverdata);
|
SDL_free(mode.internal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -521,8 +521,8 @@ static CGError SetDisplayModeForDisplay(CGDirectDisplayID display, SDL_DisplayMo
|
||||||
|
|
||||||
int Cocoa_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
|
int Cocoa_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
|
||||||
SDL_DisplayModeData *data = (SDL_DisplayModeData *)mode->driverdata;
|
SDL_DisplayModeData *data = mode->internal;
|
||||||
CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken;
|
CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken;
|
||||||
CGError result = kCGErrorSuccess;
|
CGError result = kCGErrorSuccess;
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ int Cocoa_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_
|
||||||
CGDisplayFade(fade_token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE);
|
CGDisplayFade(fade_token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data == display->desktop_mode.driverdata) {
|
if (data == display->desktop_mode.internal) {
|
||||||
/* Restoring desktop mode */
|
/* Restoring desktop mode */
|
||||||
SetDisplayModeForDisplay(displaydata->display, data);
|
SetDisplayModeForDisplay(displaydata->display, data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -564,15 +564,15 @@ void Cocoa_QuitModes(SDL_VideoDevice *_this)
|
||||||
SDL_VideoDisplay *display = _this->displays[i];
|
SDL_VideoDisplay *display = _this->displays[i];
|
||||||
SDL_DisplayModeData *mode;
|
SDL_DisplayModeData *mode;
|
||||||
|
|
||||||
if (display->current_mode->driverdata != display->desktop_mode.driverdata) {
|
if (display->current_mode->internal != display->desktop_mode.internal) {
|
||||||
Cocoa_SetDisplayMode(_this, display, &display->desktop_mode);
|
Cocoa_SetDisplayMode(_this, display, &display->desktop_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = (SDL_DisplayModeData *)display->desktop_mode.driverdata;
|
mode = display->desktop_mode.internal;
|
||||||
CFRelease(mode->modes);
|
CFRelease(mode->modes);
|
||||||
|
|
||||||
for (j = 0; j < display->num_fullscreen_modes; j++) {
|
for (j = 0; j < display->num_fullscreen_modes; j++) {
|
||||||
mode = (SDL_DisplayModeData *)display->fullscreen_modes[j].driverdata;
|
mode = display->fullscreen_modes[j].internal;
|
||||||
CFRelease(mode->modes);
|
CFRelease(mode->modes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ static SDL_Cursor *Cocoa_CreateDefaultCursor(void)
|
||||||
if (nscursor) {
|
if (nscursor) {
|
||||||
cursor = SDL_calloc(1, sizeof(*cursor));
|
cursor = SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
cursor->driverdata = (void *)CFBridgingRetain(nscursor);
|
cursor->internal = (void *)CFBridgingRetain(nscursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static SDL_Cursor *Cocoa_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y
|
||||||
if (nscursor) {
|
if (nscursor) {
|
||||||
cursor = SDL_calloc(1, sizeof(*cursor));
|
cursor = SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
cursor->driverdata = (void *)CFBridgingRetain(nscursor);
|
cursor->internal = (void *)CFBridgingRetain(nscursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ static SDL_Cursor *Cocoa_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
cursor = SDL_calloc(1, sizeof(*cursor));
|
cursor = SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
/* We'll free it later, so retain it here */
|
/* We'll free it later, so retain it here */
|
||||||
cursor->driverdata = (void *)CFBridgingRetain(nscursor);
|
cursor->internal = (void *)CFBridgingRetain(nscursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ static SDL_Cursor *Cocoa_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
static void Cocoa_FreeCursor(SDL_Cursor *cursor)
|
static void Cocoa_FreeCursor(SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
CFBridgingRelease(cursor->driverdata);
|
CFBridgingRelease(cursor->internal);
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,10 +243,10 @@ static int Cocoa_ShowCursor(SDL_Cursor *cursor)
|
||||||
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
||||||
SDL_Window *window = (device ? device->windows : NULL);
|
SDL_Window *window = (device ? device->windows : NULL);
|
||||||
for (; window != NULL; window = window->next) {
|
for (; window != NULL; window = window->next) {
|
||||||
SDL_CocoaWindowData *driverdata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *internal = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
if (driverdata) {
|
if (internal) {
|
||||||
[driverdata.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:)
|
[internal.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:)
|
||||||
withObject:[driverdata.nswindow contentView]
|
withObject:[internal.nswindow contentView]
|
||||||
waitUntilDone:NO];
|
waitUntilDone:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ static int Cocoa_WarpMouseGlobal(float x, float y)
|
||||||
CGPoint point;
|
CGPoint point;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
if (mouse->focus) {
|
if (mouse->focus) {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)mouse->focus->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)mouse->focus->internal;
|
||||||
if ([data.listener isMovingOrFocusClickPending]) {
|
if ([data.listener isMovingOrFocusClickPending]) {
|
||||||
DLog("Postponing warp, window being moved or focused.");
|
DLog("Postponing warp, window being moved or focused.");
|
||||||
[data.listener setPendingMoveX:x Y:y];
|
[data.listener setPendingMoveX:x Y:y];
|
||||||
|
@ -346,7 +346,7 @@ static int Cocoa_SetRelativeMouseMode(SDL_bool enabled)
|
||||||
/* We will re-apply the non-relative mode when the window finishes being moved,
|
/* We will re-apply the non-relative mode when the window finishes being moved,
|
||||||
* if it is being moved right now.
|
* if it is being moved right now.
|
||||||
*/
|
*/
|
||||||
data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
if ([data.listener isMovingOrFocusClickPending]) {
|
if ([data.listener isMovingOrFocusClickPending]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -391,12 +391,12 @@ int Cocoa_InitMouse(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
NSPoint location;
|
NSPoint location;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_MouseData *driverdata = (SDL_MouseData *)SDL_calloc(1, sizeof(SDL_MouseData));
|
SDL_MouseData *internal = (SDL_MouseData *)SDL_calloc(1, sizeof(SDL_MouseData));
|
||||||
if (driverdata == NULL) {
|
if (internal == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse->driverdata = driverdata;
|
mouse->internal = internal;
|
||||||
mouse->CreateCursor = Cocoa_CreateCursor;
|
mouse->CreateCursor = Cocoa_CreateCursor;
|
||||||
mouse->CreateSystemCursor = Cocoa_CreateSystemCursor;
|
mouse->CreateSystemCursor = Cocoa_CreateSystemCursor;
|
||||||
mouse->ShowCursor = Cocoa_ShowCursor;
|
mouse->ShowCursor = Cocoa_ShowCursor;
|
||||||
|
@ -410,8 +410,8 @@ int Cocoa_InitMouse(SDL_VideoDevice *_this)
|
||||||
SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());
|
SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());
|
||||||
|
|
||||||
location = [NSEvent mouseLocation];
|
location = [NSEvent mouseLocation];
|
||||||
driverdata->lastMoveX = location.x;
|
internal->lastMoveX = location.x;
|
||||||
driverdata->lastMoveY = location.y;
|
internal->lastMoveY = location.y;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ static void Cocoa_HandleTitleButtonEvent(SDL_VideoDevice *_this, NSEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (window = _this->windows; window; window = window->next) {
|
for (window = _this->windows; window; window = window->next) {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
if (data && data.nswindow == nswindow) {
|
if (data && data.nswindow == nswindow) {
|
||||||
switch ([event type]) {
|
switch ([event type]) {
|
||||||
case NSEventTypeLeftMouseDown:
|
case NSEventTypeLeftMouseDown:
|
||||||
|
@ -452,7 +452,7 @@ void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event)
|
||||||
{
|
{
|
||||||
SDL_MouseID mouseID = SDL_DEFAULT_MOUSE_ID;
|
SDL_MouseID mouseID = SDL_DEFAULT_MOUSE_ID;
|
||||||
SDL_Mouse *mouse;
|
SDL_Mouse *mouse;
|
||||||
SDL_MouseData *driverdata;
|
SDL_MouseData *data;
|
||||||
NSPoint location;
|
NSPoint location;
|
||||||
CGFloat lastMoveX, lastMoveY;
|
CGFloat lastMoveX, lastMoveY;
|
||||||
float deltaX, deltaY;
|
float deltaX, deltaY;
|
||||||
|
@ -485,19 +485,19 @@ void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse = SDL_GetMouse();
|
mouse = SDL_GetMouse();
|
||||||
driverdata = (SDL_MouseData *)mouse->driverdata;
|
data = (SDL_MouseData *)mouse->internal;
|
||||||
if (!driverdata) {
|
if (!data) {
|
||||||
return; /* can happen when returning from fullscreen Space on shutdown */
|
return; /* can happen when returning from fullscreen Space on shutdown */
|
||||||
}
|
}
|
||||||
|
|
||||||
seenWarp = driverdata->seenWarp;
|
seenWarp = data->seenWarp;
|
||||||
driverdata->seenWarp = NO;
|
data->seenWarp = NO;
|
||||||
|
|
||||||
location = [NSEvent mouseLocation];
|
location = [NSEvent mouseLocation];
|
||||||
lastMoveX = driverdata->lastMoveX;
|
lastMoveX = data->lastMoveX;
|
||||||
lastMoveY = driverdata->lastMoveY;
|
lastMoveY = data->lastMoveY;
|
||||||
driverdata->lastMoveX = location.x;
|
data->lastMoveX = location.x;
|
||||||
driverdata->lastMoveY = location.y;
|
data->lastMoveY = location.y;
|
||||||
DLog("Last seen mouse: (%g, %g)", location.x, location.y);
|
DLog("Last seen mouse: (%g, %g)", location.x, location.y);
|
||||||
|
|
||||||
/* Non-relative movement is handled in -[Cocoa_WindowListener mouseMoved:] */
|
/* Non-relative movement is handled in -[Cocoa_WindowListener mouseMoved:] */
|
||||||
|
@ -517,8 +517,8 @@ void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event)
|
||||||
deltaY = [event deltaY];
|
deltaY = [event deltaY];
|
||||||
|
|
||||||
if (seenWarp) {
|
if (seenWarp) {
|
||||||
deltaX += (lastMoveX - driverdata->lastWarpX);
|
deltaX += (lastMoveX - data->lastWarpX);
|
||||||
deltaY += ((CGDisplayPixelsHigh(kCGDirectMainDisplay) - lastMoveY) - driverdata->lastWarpY);
|
deltaY += ((CGDisplayPixelsHigh(kCGDirectMainDisplay) - lastMoveY) - data->lastWarpY);
|
||||||
|
|
||||||
DLog("Motion was (%g, %g), offset to (%g, %g)", [event deltaX], [event deltaY], deltaX, deltaY);
|
DLog("Motion was (%g, %g), offset to (%g, %g)", [event deltaX], [event deltaY], deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
@ -563,10 +563,10 @@ void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y)
|
||||||
/* This makes Cocoa_HandleMouseEvent ignore the delta caused by the warp,
|
/* This makes Cocoa_HandleMouseEvent ignore the delta caused by the warp,
|
||||||
* since it gets included in the next movement event.
|
* since it gets included in the next movement event.
|
||||||
*/
|
*/
|
||||||
SDL_MouseData *driverdata = (SDL_MouseData *)SDL_GetMouse()->driverdata;
|
SDL_MouseData *data = (SDL_MouseData *)SDL_GetMouse()->internal;
|
||||||
driverdata->lastWarpX = x;
|
data->lastWarpX = x;
|
||||||
driverdata->lastWarpY = y;
|
data->lastWarpY = y;
|
||||||
driverdata->seenWarp = SDL_TRUE;
|
data->seenWarp = SDL_TRUE;
|
||||||
|
|
||||||
DLog("(%g, %g)", x, y);
|
DLog("(%g, %g)", x, y);
|
||||||
}
|
}
|
||||||
|
@ -575,9 +575,9 @@ void Cocoa_QuitMouse(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
if (mouse) {
|
if (mouse) {
|
||||||
if (mouse->driverdata) {
|
if (mouse->internal) {
|
||||||
SDL_free(mouse->driverdata);
|
SDL_free(mouse->internal);
|
||||||
mouse->driverdata = NULL;
|
mouse->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
- (void)setWindow:(SDL_Window *)newWindow
|
- (void)setWindow:(SDL_Window *)newWindow
|
||||||
{
|
{
|
||||||
if (self->window) {
|
if (self->window) {
|
||||||
SDL_CocoaWindowData *oldwindowdata = (__bridge SDL_CocoaWindowData *)self->window->driverdata;
|
SDL_CocoaWindowData *oldwindowdata = (__bridge SDL_CocoaWindowData *)self->window->internal;
|
||||||
|
|
||||||
/* Make sure to remove us from the old window's context list, or we'll get scheduled updates from it too. */
|
/* Make sure to remove us from the old window's context list, or we'll get scheduled updates from it too. */
|
||||||
NSMutableArray *contexts = oldwindowdata.nscontexts;
|
NSMutableArray *contexts = oldwindowdata.nscontexts;
|
||||||
|
@ -150,7 +150,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
self->window = newWindow;
|
self->window = newWindow;
|
||||||
|
|
||||||
if (newWindow) {
|
if (newWindow) {
|
||||||
SDL_CocoaWindowData *windowdata = (__bridge SDL_CocoaWindowData *)newWindow->driverdata;
|
SDL_CocoaWindowData *windowdata = (__bridge SDL_CocoaWindowData *)newWindow->internal;
|
||||||
NSView *contentview = windowdata.sdlContentView;
|
NSView *contentview = windowdata.sdlContentView;
|
||||||
|
|
||||||
/* Now sign up for scheduled updates for the new window. */
|
/* Now sign up for scheduled updates for the new window. */
|
||||||
|
@ -258,7 +258,7 @@ SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
|
||||||
NSOpenGLPixelFormatAttribute attr[32];
|
NSOpenGLPixelFormatAttribute attr[32];
|
||||||
NSOpenGLPixelFormat *fmt;
|
NSOpenGLPixelFormat *fmt;
|
||||||
SDLOpenGLContext *context;
|
SDLOpenGLContext *context;
|
||||||
|
@ -490,7 +490,7 @@ int Cocoa_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
|
SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
|
||||||
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting);
|
const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting);
|
||||||
|
|
||||||
if (setting == 0) {
|
if (setting == 0) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ SDL_GLContext Cocoa_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *windo
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_GLContext context;
|
SDL_GLContext context;
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_OPENGL_CGL
|
#ifdef SDL_VIDEO_OPENGL_CGL
|
||||||
if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
|
if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
|
||||||
|
@ -102,14 +102,14 @@ int Cocoa_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
||||||
int Cocoa_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int Cocoa_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return SDL_EGL_SwapBuffers(_this, ((__bridge SDL_CocoaWindowData *)window->driverdata).egl_surface);
|
return SDL_EGL_SwapBuffers(_this, ((__bridge SDL_CocoaWindowData *)window->internal).egl_surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Cocoa_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
int Cocoa_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return SDL_EGL_MakeCurrent(_this, window ? ((__bridge SDL_CocoaWindowData *)window->driverdata).egl_surface : EGL_NO_SURFACE, context);
|
return SDL_EGL_MakeCurrent(_this, window ? ((__bridge SDL_CocoaWindowData *)window->internal).egl_surface : EGL_NO_SURFACE, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ int Cocoa_GLES_SetupWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSView *v;
|
NSView *v;
|
||||||
/* The current context is lost in here; save it and reset it. */
|
/* The current context is lost in here; save it and reset it. */
|
||||||
SDL_CocoaWindowData *windowdata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windowdata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
SDL_Window *current_win = SDL_GL_GetCurrentWindow();
|
SDL_Window *current_win = SDL_GL_GetCurrentWindow();
|
||||||
SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
|
SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ int Cocoa_GLES_SetupWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
SDL_EGLSurface Cocoa_GLES_GetEGLSurface(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_EGLSurface Cocoa_GLES_GetEGLSurface(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
return ((__bridge SDL_CocoaWindowData *)window->driverdata).egl_surface;
|
return ((__bridge SDL_CocoaWindowData *)window->internal).egl_surface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
int Cocoa_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *shape)
|
int Cocoa_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *shape)
|
||||||
{
|
{
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
BOOL ignoresMouseEvents = NO;
|
BOOL ignoresMouseEvents = NO;
|
||||||
|
|
||||||
if (shape) {
|
if (shape) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice *device)
|
||||||
if (device->wakeup_lock) {
|
if (device->wakeup_lock) {
|
||||||
SDL_DestroyMutex(device->wakeup_lock);
|
SDL_DestroyMutex(device->wakeup_lock);
|
||||||
}
|
}
|
||||||
CFBridgingRelease(device->driverdata);
|
CFBridgingRelease(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
device->driverdata = (SDL_VideoData *)CFBridgingRetain(data);
|
device->internal = (SDL_VideoData *)CFBridgingRetain(data);
|
||||||
device->wakeup_lock = SDL_CreateMutex();
|
device->wakeup_lock = SDL_CreateMutex();
|
||||||
device->system_theme = Cocoa_GetSystemTheme();
|
device->system_theme = Cocoa_GetSystemTheme();
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ VideoBootStrap COCOA_bootstrap = {
|
||||||
int Cocoa_VideoInit(SDL_VideoDevice *_this)
|
int Cocoa_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
|
|
||||||
Cocoa_InitModes(_this);
|
Cocoa_InitModes(_this);
|
||||||
Cocoa_InitKeyboard(_this);
|
Cocoa_InitKeyboard(_this);
|
||||||
|
@ -223,7 +223,7 @@ int Cocoa_VideoInit(SDL_VideoDevice *_this)
|
||||||
void Cocoa_VideoQuit(SDL_VideoDevice *_this)
|
void Cocoa_VideoQuit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
Cocoa_QuitModes(_this);
|
Cocoa_QuitModes(_this);
|
||||||
Cocoa_QuitKeyboard(_this);
|
Cocoa_QuitKeyboard(_this);
|
||||||
Cocoa_QuitMouse(_this);
|
Cocoa_QuitMouse(_this);
|
||||||
|
|
|
@ -255,7 +255,7 @@ int Cocoa_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
if (window->flags & SDL_WINDOW_EXTERNAL) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
if (![data.sdlContentView.layer isKindOfClass:[CAMetalLayer class]]) {
|
if (![data.sdlContentView.layer isKindOfClass:[CAMetalLayer class]]) {
|
||||||
[data.sdlContentView setLayer:[CAMetalLayer layer]];
|
[data.sdlContentView setLayer:[CAMetalLayer layer]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@
|
||||||
/* !!! FIXME: is there a better way to do this? */
|
/* !!! FIXME: is there a better way to do this? */
|
||||||
if (_this) {
|
if (_this) {
|
||||||
for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) {
|
for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) {
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)sdlwindow->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)sdlwindow->internal).nswindow;
|
||||||
if (nswindow == self) {
|
if (nswindow == self) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ static NSUInteger GetWindowStyle(SDL_Window *window)
|
||||||
|
|
||||||
static SDL_bool SetWindowStyle(SDL_Window *window, NSUInteger style)
|
static SDL_bool SetWindowStyle(SDL_Window *window, NSUInteger style)
|
||||||
{
|
{
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
|
|
||||||
/* The view responder chain gets messed with during setStyleMask */
|
/* The view responder chain gets messed with during setStyleMask */
|
||||||
|
@ -436,7 +436,7 @@ static SDL_bool SetWindowStyle(SDL_Window *window, NSUInteger style)
|
||||||
|
|
||||||
static SDL_bool ShouldAdjustCoordinatesForGrab(SDL_Window *window)
|
static SDL_bool ShouldAdjustCoordinatesForGrab(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
if (!data || [data.listener isMovingOrFocusClickPending]) {
|
if (!data || [data.listener isMovingOrFocusClickPending]) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
|
@ -493,7 +493,7 @@ static SDL_bool AdjustCoordinatesForGrab(SDL_Window *window, float x, float y, C
|
||||||
|
|
||||||
static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
static void Cocoa_UpdateClipCursor(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_13_2) {
|
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_13_2) {
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
|
@ -561,14 +561,14 @@ static void Cocoa_SetKeyboardFocus(SDL_Window *window)
|
||||||
SDL_Window *topmost = GetTopmostWindow(window);
|
SDL_Window *topmost = GetTopmostWindow(window);
|
||||||
SDL_CocoaWindowData *topmost_data;
|
SDL_CocoaWindowData *topmost_data;
|
||||||
|
|
||||||
topmost_data = (__bridge SDL_CocoaWindowData *)topmost->driverdata;
|
topmost_data = (__bridge SDL_CocoaWindowData *)topmost->internal;
|
||||||
topmost_data.keyboard_focus = window;
|
topmost_data.keyboard_focus = window;
|
||||||
SDL_SetKeyboardFocus(window);
|
SDL_SetKeyboardFocus(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cocoa_SendExposedEventIfVisible(SDL_Window *window)
|
static void Cocoa_SendExposedEventIfVisible(SDL_Window *window)
|
||||||
{
|
{
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->internal).nswindow;
|
||||||
if ([nswindow occlusionState] & NSWindowOcclusionStateVisible) {
|
if ([nswindow occlusionState] & NSWindowOcclusionStateVisible) {
|
||||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ static void Cocoa_SendExposedEventIfVisible(SDL_Window *window)
|
||||||
|
|
||||||
static void Cocoa_WaitForMiniaturizable(SDL_Window *window)
|
static void Cocoa_WaitForMiniaturizable(SDL_Window *window)
|
||||||
{
|
{
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->internal).nswindow;
|
||||||
NSButton *button = [nswindow standardWindowButton:NSWindowMiniaturizeButton];
|
NSButton *button = [nswindow standardWindowButton:NSWindowMiniaturizeButton];
|
||||||
if (button) {
|
if (button) {
|
||||||
int iterations = 0;
|
int iterations = 0;
|
||||||
|
@ -590,7 +590,7 @@ static void Cocoa_WaitForMiniaturizable(SDL_Window *window)
|
||||||
|
|
||||||
static SDL_bool Cocoa_IsZoomed(SDL_Window *window)
|
static SDL_bool Cocoa_IsZoomed(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
data.checking_zoom = YES;
|
data.checking_zoom = YES;
|
||||||
const SDL_bool ret = [data.nswindow isZoomed];
|
const SDL_bool ret = [data.nswindow isZoomed];
|
||||||
|
@ -604,7 +604,7 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
|
|
||||||
if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) {
|
if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) {
|
||||||
return (__bridge NSCursor *)mouse->cur_cursor->driverdata;
|
return (__bridge NSCursor *)mouse->cur_cursor->internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [NSCursor invisibleCursor];
|
return [NSCursor invisibleCursor];
|
||||||
|
@ -717,7 +717,7 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
||||||
{
|
{
|
||||||
SDL_Window *window = _data.window;
|
SDL_Window *window = _data.window;
|
||||||
NSWindow *nswindow = _data.nswindow;
|
NSWindow *nswindow = _data.nswindow;
|
||||||
SDL_CocoaVideoData *videodata = ((__bridge SDL_CocoaWindowData *)window->driverdata).videodata;
|
SDL_CocoaVideoData *videodata = ((__bridge SDL_CocoaWindowData *)window->internal).videodata;
|
||||||
|
|
||||||
if (!videodata.allow_spaces) {
|
if (!videodata.allow_spaces) {
|
||||||
return NO; /* Spaces are forcibly disabled. */
|
return NO; /* Spaces are forcibly disabled. */
|
||||||
|
@ -1494,7 +1494,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
// the position in the currently-focused window. We don't (currently) send a mousemove
|
// the position in the currently-focused window. We don't (currently) send a mousemove
|
||||||
// event for the background window, this just makes sure the button is reported at the
|
// event for the background window, this just makes sure the button is reported at the
|
||||||
// correct position in its own event.
|
// correct position in its own event.
|
||||||
if (focus && ([theEvent window] == ((__bridge SDL_CocoaWindowData *)focus->driverdata).nswindow)) {
|
if (focus && ([theEvent window] == ((__bridge SDL_CocoaWindowData *)focus->internal).nswindow)) {
|
||||||
rc = SDL_SendMouseButtonClicks(Cocoa_GetEventTimestamp([theEvent timestamp]), window, mouseID, state, button, clicks);
|
rc = SDL_SendMouseButtonClicks(Cocoa_GetEventTimestamp([theEvent timestamp]), window, mouseID, state, button, clicks);
|
||||||
} else {
|
} else {
|
||||||
const float orig_x = mouse->x;
|
const float orig_x = mouse->x;
|
||||||
|
@ -1694,7 +1694,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
- (BOOL)isTouchFromTrackpad:(NSEvent *)theEvent
|
- (BOOL)isTouchFromTrackpad:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
SDL_Window *window = _data.window;
|
SDL_Window *window = _data.window;
|
||||||
SDL_CocoaVideoData *videodata = ((__bridge SDL_CocoaWindowData *)window->driverdata).videodata;
|
SDL_CocoaVideoData *videodata = ((__bridge SDL_CocoaWindowData *)window->internal).videodata;
|
||||||
|
|
||||||
/* if this a MacBook trackpad, we'll make input look like a synthesized
|
/* if this a MacBook trackpad, we'll make input look like a synthesized
|
||||||
event. This is backwards from reality, but better matches user
|
event. This is backwards from reality, but better matches user
|
||||||
|
@ -1892,7 +1892,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
BOOL transparent = (_sdlWindow->flags & SDL_WINDOW_TRANSPARENT) != 0;
|
BOOL transparent = (_sdlWindow->flags & SDL_WINDOW_TRANSPARENT) != 0;
|
||||||
CFStringRef color = transparent ? kCGColorClear : kCGColorBlack;
|
CFStringRef color = transparent ? kCGColorClear : kCGColorBlack;
|
||||||
self.layer.backgroundColor = CGColorGetConstantColor(color);
|
self.layer.backgroundColor = CGColorGetConstantColor(color);
|
||||||
ScheduleContextUpdates((__bridge SDL_CocoaWindowData *)_sdlWindow->driverdata);
|
ScheduleContextUpdates((__bridge SDL_CocoaWindowData *)_sdlWindow->internal);
|
||||||
Cocoa_SendExposedEventIfVisible(_sdlWindow);
|
Cocoa_SendExposedEventIfVisible(_sdlWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1930,7 +1930,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
|
||||||
static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow *nswindow, NSView *nsview)
|
static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow *nswindow, NSView *nsview)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
SDL_CocoaWindowData *data;
|
SDL_CocoaWindowData *data;
|
||||||
|
|
||||||
/* Allocate the window data */
|
/* Allocate the window data */
|
||||||
|
@ -2006,7 +2006,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
|
||||||
Cocoa_SetKeyboardFocus(data.window);
|
Cocoa_SetKeyboardFocus(data.window);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
|
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->internal).nswindow;
|
||||||
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_TOOLTIP) {
|
if (window->flags & SDL_WINDOW_TOOLTIP) {
|
||||||
|
@ -2058,7 +2058,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, SDL_METALVIEW_TAG);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, SDL_METALVIEW_TAG);
|
||||||
|
|
||||||
/* All done! */
|
/* All done! */
|
||||||
window->driverdata = (SDL_WindowData *)CFBridgingRetain(data);
|
window->internal = (SDL_WindowData *)CFBridgingRetain(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2066,7 +2066,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
|
||||||
int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->driverdata;
|
SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->internal;
|
||||||
const void *data = SDL_GetPointerProperty(create_props, "sdl2-compat.external_window", NULL);
|
const void *data = SDL_GetPointerProperty(create_props, "sdl2-compat.external_window", NULL);
|
||||||
NSWindow *nswindow = nil;
|
NSWindow *nswindow = nil;
|
||||||
NSView *nsview = nil;
|
NSView *nsview = nil;
|
||||||
|
@ -2225,7 +2225,7 @@ void Cocoa_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
const char *title = window->title ? window->title : "";
|
const char *title = window->title ? window->title : "";
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->internal).nswindow;
|
||||||
NSString *string = [[NSString alloc] initWithUTF8String:title];
|
NSString *string = [[NSString alloc] initWithUTF8String:title];
|
||||||
[nswindow setTitle:string];
|
[nswindow setTitle:string];
|
||||||
}
|
}
|
||||||
|
@ -2249,7 +2249,7 @@ int Cocoa_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface
|
||||||
int Cocoa_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
|
int Cocoa_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = windata.nswindow;
|
NSWindow *nswindow = windata.nswindow;
|
||||||
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
||||||
BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
|
@ -2302,7 +2302,7 @@ int Cocoa_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = windata.nswindow;
|
NSWindow *nswindow = windata.nswindow;
|
||||||
|
|
||||||
if ([windata.listener windowOperationIsPending:(PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN)] ||
|
if ([windata.listener windowOperationIsPending:(PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN)] ||
|
||||||
|
@ -2341,7 +2341,7 @@ void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
NSSize minSize;
|
NSSize minSize;
|
||||||
minSize.width = window->min_w;
|
minSize.width = window->min_w;
|
||||||
|
@ -2354,7 +2354,7 @@ void Cocoa_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
NSSize maxSize;
|
NSSize maxSize;
|
||||||
maxSize.width = window->max_w;
|
maxSize.width = window->max_w;
|
||||||
|
@ -2367,7 +2367,7 @@ void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
|
void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSView *contentView = windata.sdlContentView;
|
NSView *contentView = windata.sdlContentView;
|
||||||
NSRect viewport = [contentView bounds];
|
NSRect viewport = [contentView bounds];
|
||||||
|
|
||||||
|
@ -2384,14 +2384,14 @@ void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int
|
||||||
void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windowData = ((__bridge SDL_CocoaWindowData *)window->driverdata);
|
SDL_CocoaWindowData *windowData = ((__bridge SDL_CocoaWindowData *)window->internal);
|
||||||
NSWindow *nswindow = windowData.nswindow;
|
NSWindow *nswindow = windowData.nswindow;
|
||||||
SDL_bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, SDL_TRUE);
|
SDL_bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, SDL_TRUE);
|
||||||
|
|
||||||
if (![nswindow isMiniaturized]) {
|
if (![nswindow isMiniaturized]) {
|
||||||
[windowData.listener pauseVisibleObservation];
|
[windowData.listener pauseVisibleObservation];
|
||||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||||
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
|
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->internal).nswindow;
|
||||||
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
||||||
} else {
|
} else {
|
||||||
if ((window->flags & SDL_WINDOW_MODAL) && window->parent) {
|
if ((window->flags & SDL_WINDOW_MODAL) && window->parent) {
|
||||||
|
@ -2416,7 +2416,7 @@ void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->internal).nswindow;
|
||||||
|
|
||||||
/* orderOut has no effect on miniaturized windows, so close must be used to remove
|
/* orderOut has no effect on miniaturized windows, so close must be used to remove
|
||||||
* the window from the desktop and window list in this case.
|
* the window from the desktop and window list in this case.
|
||||||
|
@ -2455,7 +2455,7 @@ void Cocoa_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windowData = ((__bridge SDL_CocoaWindowData *)window->driverdata);
|
SDL_CocoaWindowData *windowData = ((__bridge SDL_CocoaWindowData *)window->internal);
|
||||||
NSWindow *nswindow = windowData.nswindow;
|
NSWindow *nswindow = windowData.nswindow;
|
||||||
SDL_bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED, SDL_TRUE);
|
SDL_bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED, SDL_TRUE);
|
||||||
|
|
||||||
|
@ -2465,7 +2465,7 @@ void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
[windowData.listener pauseVisibleObservation];
|
[windowData.listener pauseVisibleObservation];
|
||||||
if (![nswindow isMiniaturized] && [nswindow isVisible]) {
|
if (![nswindow isMiniaturized] && [nswindow isVisible]) {
|
||||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||||
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
|
NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->internal).nswindow;
|
||||||
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
[nsparent addChildWindow:nswindow ordered:NSWindowAbove];
|
||||||
if (bActivate) {
|
if (bActivate) {
|
||||||
[nswindow makeKeyWindow];
|
[nswindow makeKeyWindow];
|
||||||
|
@ -2486,7 +2486,7 @@ void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = windata.nswindow;
|
NSWindow *nswindow = windata.nswindow;
|
||||||
|
|
||||||
if ([windata.listener windowOperationIsPending:(PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN)] ||
|
if ([windata.listener windowOperationIsPending:(PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN)] ||
|
||||||
|
@ -2506,7 +2506,7 @@ void Cocoa_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
|
|
||||||
[data.listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE];
|
[data.listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE];
|
||||||
|
@ -2524,7 +2524,7 @@ void Cocoa_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
|
|
||||||
if ([data.listener windowOperationIsPending:(PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN)] ||
|
if ([data.listener windowOperationIsPending:(PENDING_OPERATION_ENTER_FULLSCREEN | PENDING_OPERATION_LEAVE_FULLSCREEN)] ||
|
||||||
|
@ -2567,7 +2567,7 @@ void Cocoa_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void Cocoa_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered)
|
void Cocoa_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
/* If the window is in or transitioning to/from fullscreen, this will be set on leave. */
|
/* If the window is in or transitioning to/from fullscreen, this will be set on leave. */
|
||||||
if (!(window->flags & SDL_WINDOW_FULLSCREEN) && ![data.listener isInFullscreenSpaceTransition]) {
|
if (!(window->flags & SDL_WINDOW_FULLSCREEN) && ![data.listener isInFullscreenSpaceTransition]) {
|
||||||
|
@ -2589,7 +2589,7 @@ void Cocoa_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bo
|
||||||
* The window will get permanently stuck if resizable is false.
|
* The window will get permanently stuck if resizable is false.
|
||||||
* -flibit
|
* -flibit
|
||||||
*/
|
*/
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
Cocoa_WindowListener *listener = data.listener;
|
Cocoa_WindowListener *listener = data.listener;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
SDL_CocoaVideoData *videodata = data.videodata;
|
SDL_CocoaVideoData *videodata = data.videodata;
|
||||||
|
@ -2610,7 +2610,7 @@ void Cocoa_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bo
|
||||||
void Cocoa_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool on_top)
|
void Cocoa_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool on_top)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
|
|
||||||
/* If the window is in or transitioning to/from fullscreen, this will be set on leave. */
|
/* If the window is in or transitioning to/from fullscreen, this will be set on leave. */
|
||||||
|
@ -2627,7 +2627,7 @@ void Cocoa_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, SDL_
|
||||||
int Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen)
|
int Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
|
|
||||||
|
@ -2733,7 +2733,7 @@ int Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_Vi
|
||||||
void *Cocoa_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t *size)
|
void *Cocoa_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t *size)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
NSWindow *nswindow = data.nswindow;
|
NSWindow *nswindow = data.nswindow;
|
||||||
NSScreen *screen = [nswindow screen];
|
NSScreen *screen = [nswindow screen];
|
||||||
NSData *iccProfileData = nil;
|
NSData *iccProfileData = nil;
|
||||||
|
@ -2770,7 +2770,7 @@ SDL_DisplayID Cocoa_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Window *wind
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSScreen *screen;
|
NSScreen *screen;
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
/* Not recognized via CHECK_WINDOW_MAGIC */
|
/* Not recognized via CHECK_WINDOW_MAGIC */
|
||||||
if (data == nil) {
|
if (data == nil) {
|
||||||
|
@ -2790,7 +2790,7 @@ SDL_DisplayID Cocoa_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Window *wind
|
||||||
displayid = [[screen.deviceDescription objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
displayid = [[screen.deviceDescription objectForKey:@"NSScreenNumber"] unsignedIntValue];
|
||||||
|
|
||||||
for (i = 0; i < _this->num_displays; i++) {
|
for (i = 0; i < _this->num_displays; i++) {
|
||||||
SDL_DisplayData *displaydata = _this->displays[i]->driverdata;
|
SDL_DisplayData *displaydata = _this->displays[i]->internal;
|
||||||
if (displaydata != NULL && displaydata->display == displayid) {
|
if (displaydata != NULL && displaydata->display == displayid) {
|
||||||
return _this->displays[i]->id;
|
return _this->displays[i]->id;
|
||||||
}
|
}
|
||||||
|
@ -2811,7 +2811,7 @@ int Cocoa_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
int Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed)
|
int Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
Cocoa_UpdateClipCursor(window);
|
Cocoa_UpdateClipCursor(window);
|
||||||
|
|
||||||
|
@ -2834,7 +2834,7 @@ int Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_boo
|
||||||
void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (SDL_CocoaWindowData *)CFBridgingRelease(window->driverdata);
|
SDL_CocoaWindowData *data = (SDL_CocoaWindowData *)CFBridgingRelease(window->internal);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
#ifdef SDL_VIDEO_OPENGL
|
#ifdef SDL_VIDEO_OPENGL
|
||||||
|
@ -2843,7 +2843,7 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_OPENGL */
|
#endif /* SDL_VIDEO_OPENGL */
|
||||||
SDL_Window *topmost = GetTopmostWindow(window);
|
SDL_Window *topmost = GetTopmostWindow(window);
|
||||||
SDL_CocoaWindowData *topmost_data = (__bridge SDL_CocoaWindowData *)topmost->driverdata;
|
SDL_CocoaWindowData *topmost_data = (__bridge SDL_CocoaWindowData *)topmost->internal;
|
||||||
|
|
||||||
/* Reset the input focus of the root window if this window is still set as keyboard focus.
|
/* Reset the input focus of the root window if this window is still set as keyboard focus.
|
||||||
* SDL_DestroyWindow will have already taken care of reassigning focus if this is the SDL
|
* SDL_DestroyWindow will have already taken care of reassigning focus if this is the SDL
|
||||||
|
@ -2881,14 +2881,14 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_OPENGL */
|
#endif /* SDL_VIDEO_OPENGL */
|
||||||
}
|
}
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window)
|
SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
if ([data.listener isInFullscreenSpace]) {
|
if ([data.listener isInFullscreenSpace]) {
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
|
@ -2902,7 +2902,7 @@ SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, SDL_bool state, SDL_
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_bool succeeded = SDL_FALSE;
|
SDL_bool succeeded = SDL_FALSE;
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
data.in_blocking_transition = blocking;
|
data.in_blocking_transition = blocking;
|
||||||
if ([data.listener setFullscreenSpace:(state ? YES : NO)]) {
|
if ([data.listener setFullscreenSpace:(state ? YES : NO)]) {
|
||||||
|
@ -2944,7 +2944,7 @@ SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, SDL_bool state, SDL_
|
||||||
|
|
||||||
int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
|
int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
|
||||||
{
|
{
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
[data.listener updateHitTest];
|
[data.listener updateHitTest];
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2953,7 +2953,7 @@ int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
|
||||||
void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept)
|
void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
if (accept) {
|
if (accept) {
|
||||||
[data.nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]];
|
[data.nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]];
|
||||||
} else {
|
} else {
|
||||||
|
@ -2965,7 +2965,7 @@ void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept)
|
||||||
int Cocoa_SetWindowModalFor(SDL_VideoDevice *_this, SDL_Window *modal_window, SDL_Window *parent_window)
|
int Cocoa_SetWindowModalFor(SDL_VideoDevice *_this, SDL_Window *modal_window, SDL_Window *parent_window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *modal_data = (__bridge SDL_CocoaWindowData *)modal_window->driverdata;
|
SDL_CocoaWindowData *modal_data = (__bridge SDL_CocoaWindowData *)modal_window->internal;
|
||||||
|
|
||||||
if (modal_data.modal_session) {
|
if (modal_data.modal_session) {
|
||||||
[NSApp endModalSession:modal_data.modal_session];
|
[NSApp endModalSession:modal_data.modal_session];
|
||||||
|
@ -2984,7 +2984,7 @@ int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOpera
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
/* Note that this is app-wide and not window-specific! */
|
/* Note that this is app-wide and not window-specific! */
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
|
|
||||||
if (data.flash_request) {
|
if (data.flash_request) {
|
||||||
[NSApp cancelUserAttentionRequest:data.flash_request];
|
[NSApp cancelUserAttentionRequest:data.flash_request];
|
||||||
|
@ -3016,7 +3016,7 @@ int Cocoa_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, SDL_boo
|
||||||
int Cocoa_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity)
|
int Cocoa_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
[data.nswindow setAlphaValue:opacity];
|
[data.nswindow setAlphaValue:opacity];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3031,7 +3031,7 @@ int Cocoa_SyncWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
* spaces transitions won't cause it to time out.
|
* spaces transitions won't cause it to time out.
|
||||||
*/
|
*/
|
||||||
Uint64 timeout = SDL_GetTicksNS() + SDL_MS_TO_NS(2000);
|
Uint64 timeout = SDL_GetTicksNS() + SDL_MS_TO_NS(2000);
|
||||||
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
|
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
|
||||||
while (SDL_TRUE) {
|
while (SDL_TRUE) {
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ int Emscripten_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *windo
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
/* Free the old framebuffer surface */
|
/* Free the old framebuffer surface */
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
surface = data->surface;
|
surface = data->surface;
|
||||||
SDL_DestroySurface(surface);
|
SDL_DestroySurface(surface);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ int Emscripten_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *windo
|
||||||
{
|
{
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
|
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
surface = data->surface;
|
surface = data->surface;
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return SDL_SetError("Couldn't find framebuffer surface for window");
|
return SDL_SetError("Couldn't find framebuffer surface for window");
|
||||||
|
@ -152,7 +152,7 @@ int Emscripten_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *windo
|
||||||
|
|
||||||
void Emscripten_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
void Emscripten_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
|
|
||||||
SDL_DestroySurface(data->surface);
|
SDL_DestroySurface(data->surface);
|
||||||
data->surface = NULL;
|
data->surface = NULL;
|
||||||
|
|
|
@ -54,7 +54,7 @@ static SDL_Cursor *Emscripten_CreateCursorFromString(const char *cursor_str, SDL
|
||||||
|
|
||||||
curdata->system_cursor = cursor_str;
|
curdata->system_cursor = cursor_str;
|
||||||
curdata->is_custom = is_custom;
|
curdata->is_custom = is_custom;
|
||||||
cursor->driverdata = curdata;
|
cursor->internal = curdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
|
@ -127,13 +127,13 @@ static void Emscripten_FreeCursor(SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
Emscripten_CursorData *curdata;
|
Emscripten_CursorData *curdata;
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
curdata = (Emscripten_CursorData *)cursor->driverdata;
|
curdata = (Emscripten_CursorData *)cursor->internal;
|
||||||
|
|
||||||
if (curdata) {
|
if (curdata) {
|
||||||
if (curdata->is_custom) {
|
if (curdata->is_custom) {
|
||||||
SDL_free((char *)curdata->system_cursor);
|
SDL_free((char *)curdata->system_cursor);
|
||||||
}
|
}
|
||||||
SDL_free(cursor->driverdata);
|
SDL_free(cursor->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
|
@ -144,8 +144,8 @@ static int Emscripten_ShowCursor(SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
Emscripten_CursorData *curdata;
|
Emscripten_CursorData *curdata;
|
||||||
if (SDL_GetMouseFocus() != NULL) {
|
if (SDL_GetMouseFocus() != NULL) {
|
||||||
if (cursor && cursor->driverdata) {
|
if (cursor && cursor->internal) {
|
||||||
curdata = (Emscripten_CursorData *)cursor->driverdata;
|
curdata = (Emscripten_CursorData *)cursor->internal;
|
||||||
|
|
||||||
if (curdata->system_cursor) {
|
if (curdata->system_cursor) {
|
||||||
/* *INDENT-OFF* */ /* clang-format off */
|
/* *INDENT-OFF* */ /* clang-format off */
|
||||||
|
@ -181,7 +181,7 @@ static int Emscripten_SetRelativeMouseMode(SDL_bool enabled)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window_data = window->driverdata;
|
window_data = window->internal;
|
||||||
|
|
||||||
if (emscripten_request_pointerlock(window_data->canvas_id, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
|
if (emscripten_request_pointerlock(window_data->canvas_id, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -88,7 +88,7 @@ SDL_GLContext Emscripten_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *
|
||||||
if (_this->gl_config.major_version == 3)
|
if (_this->gl_config.major_version == 3)
|
||||||
attribs.majorVersion = 2; /* WebGL 2.0 ~= GLES 3.0 */
|
attribs.majorVersion = 2; /* WebGL 2.0 ~= GLES 3.0 */
|
||||||
|
|
||||||
window_data = window->driverdata;
|
window_data = window->internal;
|
||||||
|
|
||||||
if (window_data->gl_context) {
|
if (window_data->gl_context) {
|
||||||
SDL_SetError("Cannot create multiple webgl contexts per window");
|
SDL_SetError("Cannot create multiple webgl contexts per window");
|
||||||
|
@ -118,7 +118,7 @@ int Emscripten_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
||||||
|
|
||||||
/* remove the context from its window */
|
/* remove the context from its window */
|
||||||
for (window = _this->windows; window; window = window->next) {
|
for (window = _this->windows; window; window = window->next) {
|
||||||
SDL_WindowData *window_data = window->driverdata;
|
SDL_WindowData *window_data = window->internal;
|
||||||
|
|
||||||
if (window_data->gl_context == context) {
|
if (window_data->gl_context == context) {
|
||||||
window_data->gl_context = NULL;
|
window_data->gl_context = NULL;
|
||||||
|
@ -142,7 +142,7 @@ int Emscripten_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_
|
||||||
{
|
{
|
||||||
/* it isn't possible to reuse contexts across canvases */
|
/* it isn't possible to reuse contexts across canvases */
|
||||||
if (window && context) {
|
if (window && context) {
|
||||||
SDL_WindowData *window_data = window->driverdata;
|
SDL_WindowData *window_data = window->internal;
|
||||||
|
|
||||||
if (context != window_data->gl_context) {
|
if (context != window_data->gl_context) {
|
||||||
return SDL_SetError("Cannot make context current to another window");
|
return SDL_SetError("Cannot make context current to another window");
|
||||||
|
|
|
@ -230,7 +230,7 @@ static int Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, S
|
||||||
wdata->window = window;
|
wdata->window = window;
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
window->driverdata = wdata;
|
window->internal = wdata;
|
||||||
|
|
||||||
/* One window, it always has focus */
|
/* One window, it always has focus */
|
||||||
SDL_SetMouseFocus(window);
|
SDL_SetMouseFocus(window);
|
||||||
|
@ -246,8 +246,8 @@ static void Emscripten_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
if (window->driverdata) {
|
if (window->internal) {
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
/* update pixel ratio */
|
/* update pixel ratio */
|
||||||
if (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) {
|
if (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) {
|
||||||
data->pixel_ratio = emscripten_get_device_pixel_ratio();
|
data->pixel_ratio = emscripten_get_device_pixel_ratio();
|
||||||
|
@ -266,8 +266,8 @@ static void Emscripten_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
static void Emscripten_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
|
static void Emscripten_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
if (window->driverdata) {
|
if (window->internal) {
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
*w = SDL_lroundf(window->w * data->pixel_ratio);
|
*w = SDL_lroundf(window->w * data->pixel_ratio);
|
||||||
*h = SDL_lroundf(window->h * data->pixel_ratio);
|
*h = SDL_lroundf(window->h * data->pixel_ratio);
|
||||||
}
|
}
|
||||||
|
@ -277,8 +277,8 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
if (window->driverdata) {
|
if (window->internal) {
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
|
|
||||||
Emscripten_UnregisterEventHandlers(data);
|
Emscripten_UnregisterEventHandlers(data);
|
||||||
|
|
||||||
|
@ -286,8 +286,8 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
emscripten_set_canvas_element_size(data->canvas_id, 0, 0);
|
emscripten_set_canvas_element_size(data->canvas_id, 0, 0);
|
||||||
SDL_free(data->canvas_id);
|
SDL_free(data->canvas_id);
|
||||||
|
|
||||||
SDL_free(window->driverdata);
|
SDL_free(window->internal);
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,8 +296,8 @@ static int Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *wi
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
if (window->driverdata) {
|
if (window->internal) {
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
EmscriptenFullscreenStrategy strategy;
|
EmscriptenFullscreenStrategy strategy;
|
||||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
||||||
return (SDL_BWin *)(window->driverdata);
|
return (SDL_BWin *)(window->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
||||||
|
|
|
@ -41,7 +41,7 @@ extern "C" {
|
||||||
#define WRAP_BMODE 1 /* FIXME: Some debate as to whether this is necessary */
|
#define WRAP_BMODE 1 /* FIXME: Some debate as to whether this is necessary */
|
||||||
|
|
||||||
#if WRAP_BMODE
|
#if WRAP_BMODE
|
||||||
/* This wrapper is here so that the driverdata can be freed without freeing
|
/* This wrapper is here so that the internal can be freed without freeing
|
||||||
the display_mode structure */
|
the display_mode structure */
|
||||||
struct SDL_DisplayModeData {
|
struct SDL_DisplayModeData {
|
||||||
display_mode *bmode;
|
display_mode *bmode;
|
||||||
|
@ -49,7 +49,7 @@ struct SDL_DisplayModeData {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
||||||
return (SDL_BWin *)(window->driverdata);
|
return (SDL_BWin *)(window->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
||||||
|
@ -58,9 +58,9 @@ static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
||||||
|
|
||||||
static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
|
static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
|
||||||
#if WRAP_BMODE
|
#if WRAP_BMODE
|
||||||
return ((SDL_DisplayModeData *)mode->driverdata)->bmode;
|
return mode->internal->bmode;
|
||||||
#else
|
#else
|
||||||
return (display_mode *)(mode->driverdata);
|
return (display_mode *)mode->internal;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,14 +173,12 @@ static void _BDisplayModeToSdlDisplayMode(display_mode *bmode, SDL_DisplayMode *
|
||||||
get_refresh_rate(*bmode, &mode->refresh_rate_numerator, &mode->refresh_rate_denominator);
|
get_refresh_rate(*bmode, &mode->refresh_rate_numerator, &mode->refresh_rate_denominator);
|
||||||
|
|
||||||
#if WRAP_BMODE
|
#if WRAP_BMODE
|
||||||
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
|
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
||||||
sizeof(SDL_DisplayModeData));
|
|
||||||
data->bmode = bmode;
|
data->bmode = bmode;
|
||||||
|
|
||||||
mode->driverdata = data;
|
mode->internal = data;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
mode->driverdata = bmode;
|
mode->internal = bmode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set the format */
|
/* Set the format */
|
||||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
||||||
return (SDL_BWin *)(window->driverdata);
|
return (SDL_BWin *)(window->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
||||||
#include "../../events/SDL_mouse_c.h"
|
#include "../../events/SDL_mouse_c.h"
|
||||||
|
|
||||||
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
||||||
return (SDL_BWin *)(window->driverdata);
|
return (SDL_BWin *)(window->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_VideoDevice * HAIKU_CreateDevice(void)
|
static SDL_VideoDevice * HAIKU_CreateDevice(void)
|
||||||
|
@ -54,7 +54,7 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void)
|
||||||
/* Initialize all variables that we clean on shutdown */
|
/* Initialize all variables that we clean on shutdown */
|
||||||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||||
|
|
||||||
device->driverdata = NULL; /* FIXME: Is this the cause of some of the
|
device->internal = NULL; /* FIXME: Is this the cause of some of the
|
||||||
SDL_Quit() errors? */
|
SDL_Quit() errors? */
|
||||||
|
|
||||||
/* TODO: Figure out if any initialization needs to go here */
|
/* TODO: Figure out if any initialization needs to go here */
|
||||||
|
@ -116,7 +116,7 @@ VideoBootStrap HAIKU_bootstrap = {
|
||||||
|
|
||||||
void HAIKU_DeleteDevice(SDL_VideoDevice * device)
|
void HAIKU_DeleteDevice(SDL_VideoDevice * device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static SDL_Cursor * HAIKU_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
|
|
||||||
SDL_Cursor *cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
SDL_Cursor *cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
cursor->driverdata = (void *)new BCursor(cursorId);
|
cursor->internal = (void *)new BCursor(cursorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
|
@ -168,8 +168,8 @@ static SDL_Cursor * HAIKU_CreateDefaultCursor()
|
||||||
|
|
||||||
static void HAIKU_FreeCursor(SDL_Cursor * cursor)
|
static void HAIKU_FreeCursor(SDL_Cursor * cursor)
|
||||||
{
|
{
|
||||||
if (cursor->driverdata) {
|
if (cursor->internal) {
|
||||||
delete (BCursor*) cursor->driverdata;
|
delete (BCursor*) cursor->internal;
|
||||||
}
|
}
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ static SDL_Cursor * HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot
|
||||||
|
|
||||||
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
cursor->driverdata = (void *)new BCursor(cursorBitmap, BPoint(hot_x, hot_y));
|
cursor->internal = (void *)new BCursor(cursorBitmap, BPoint(hot_x, hot_y));
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ static int HAIKU_ShowCursor(SDL_Cursor *cursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
BCursor *hCursor = (BCursor*)cursor->driverdata;
|
BCursor *hCursor = (BCursor*)cursor->internal;
|
||||||
be_app->SetCursor(hCursor);
|
be_app->SetCursor(hCursor);
|
||||||
} else {
|
} else {
|
||||||
BCursor *hCursor = new BCursor(B_CURSOR_ID_NO_CURSOR);
|
BCursor *hCursor = new BCursor(B_CURSOR_ID_NO_CURSOR);
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
|
||||||
return (SDL_BWin *)(window->driverdata);
|
return (SDL_BWin *)(window->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
static SDL_INLINE SDL_BLooper *_GetBeLooper() {
|
||||||
|
@ -69,7 +69,7 @@ static int _InitWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = (SDL_WindowData *)bwin;
|
window->internal = (SDL_WindowData *)bwin;
|
||||||
int32 winID = _GetBeLooper()->GetID(window);
|
int32 winID = _GetBeLooper()->GetID(window);
|
||||||
bwin->SetID(winID);
|
bwin->SetID(winID);
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window * window) {
|
||||||
_ToBeWin(window)->LockLooper(); /* This MUST be locked */
|
_ToBeWin(window)->LockLooper(); /* This MUST be locked */
|
||||||
_GetBeLooper()->ClearID(_ToBeWin(window));
|
_GetBeLooper()->ClearID(_ToBeWin(window));
|
||||||
_ToBeWin(window)->Quit();
|
_ToBeWin(window)->Quit();
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -58,12 +58,12 @@ static SDL_Cursor *KMSDRM_CreateDefaultCursor(void)
|
||||||
return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY);
|
return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a display's driverdata, destroy the cursor BO for it.
|
/* Given a display's internal, destroy the cursor BO for it.
|
||||||
To be called from KMSDRM_DestroyWindow(), as that's where we
|
To be called from KMSDRM_DestroyWindow(), as that's where we
|
||||||
destroy the driverdata for the window's display. */
|
destroy the internal for the window's display. */
|
||||||
void KMSDRM_DestroyCursorBO(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
void KMSDRM_DestroyCursorBO(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
|
|
||||||
/* Destroy the curso GBM BO. */
|
/* Destroy the curso GBM BO. */
|
||||||
if (dispdata->cursor_bo) {
|
if (dispdata->cursor_bo) {
|
||||||
|
@ -73,15 +73,15 @@ void KMSDRM_DestroyCursorBO(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a display's driverdata, create the cursor BO for it.
|
/* Given a display's internal, create the cursor BO for it.
|
||||||
To be called from KMSDRM_CreateWindow(), as that's where we
|
To be called from KMSDRM_CreateWindow(), as that's where we
|
||||||
build a window and assign a display to it. */
|
build a window and assign a display to it. */
|
||||||
int KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
|
int KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_VideoDevice *dev = SDL_GetVideoDevice();
|
SDL_VideoDevice *dev = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *viddata = dev->driverdata;
|
SDL_VideoData *viddata = dev->internal;
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
|
|
||||||
if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev,
|
if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev,
|
||||||
GBM_FORMAT_ARGB8888,
|
GBM_FORMAT_ARGB8888,
|
||||||
|
@ -116,9 +116,9 @@ int KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
|
||||||
static int KMSDRM_RemoveCursorFromBO(SDL_VideoDisplay *display)
|
static int KMSDRM_RemoveCursorFromBO(SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
SDL_VideoDevice *video_device = SDL_GetVideoDevice();
|
SDL_VideoDevice *video_device = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *viddata = video_device->driverdata;
|
SDL_VideoData *viddata = video_device->internal;
|
||||||
|
|
||||||
ret = KMSDRM_drmModeSetCursor(viddata->drm_fd,
|
ret = KMSDRM_drmModeSetCursor(viddata->drm_fd,
|
||||||
dispdata->crtc->crtc_id, 0, 0, 0);
|
dispdata->crtc->crtc_id, 0, 0, 0);
|
||||||
|
@ -133,10 +133,10 @@ static int KMSDRM_RemoveCursorFromBO(SDL_VideoDisplay *display)
|
||||||
/* Dump a cursor buffer to a display's DRM cursor BO. */
|
/* Dump a cursor buffer to a display's DRM cursor BO. */
|
||||||
static int KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor)
|
static int KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
KMSDRM_CursorData *curdata = (KMSDRM_CursorData *)cursor->driverdata;
|
KMSDRM_CursorData *curdata = (KMSDRM_CursorData *)cursor->internal;
|
||||||
SDL_VideoDevice *video_device = SDL_GetVideoDevice();
|
SDL_VideoDevice *video_device = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *viddata = video_device->driverdata;
|
SDL_VideoData *viddata = video_device->internal;
|
||||||
|
|
||||||
uint32_t bo_handle;
|
uint32_t bo_handle;
|
||||||
size_t bo_stride;
|
size_t bo_stride;
|
||||||
|
@ -210,15 +210,15 @@ static void KMSDRM_FreeCursor(SDL_Cursor *cursor)
|
||||||
|
|
||||||
/* Even if the cursor is not ours, free it. */
|
/* Even if the cursor is not ours, free it. */
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
curdata = (KMSDRM_CursorData *)cursor->driverdata;
|
curdata = (KMSDRM_CursorData *)cursor->internal;
|
||||||
/* Free cursor buffer */
|
/* Free cursor buffer */
|
||||||
if (curdata->buffer) {
|
if (curdata->buffer) {
|
||||||
SDL_free(curdata->buffer);
|
SDL_free(curdata->buffer);
|
||||||
curdata->buffer = NULL;
|
curdata->buffer = NULL;
|
||||||
}
|
}
|
||||||
/* Free cursor itself */
|
/* Free cursor itself */
|
||||||
if (cursor->driverdata) {
|
if (cursor->internal) {
|
||||||
SDL_free(cursor->driverdata);
|
SDL_free(cursor->internal);
|
||||||
}
|
}
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface *surface, int hot_x, int hot_
|
||||||
surface->format, surface->pixels, surface->pitch,
|
surface->format, surface->pixels, surface->pitch,
|
||||||
SDL_PIXELFORMAT_ARGB8888, curdata->buffer, surface->w * 4);
|
SDL_PIXELFORMAT_ARGB8888, curdata->buffer, surface->w * 4);
|
||||||
|
|
||||||
cursor->driverdata = curdata;
|
cursor->internal = curdata;
|
||||||
|
|
||||||
ret = cursor;
|
ret = cursor;
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ static int KMSDRM_WarpMouse(SDL_Window *window, float x, float y)
|
||||||
void KMSDRM_InitMouse(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
void KMSDRM_InitMouse(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
|
|
||||||
mouse->CreateCursor = KMSDRM_CreateCursor;
|
mouse->CreateCursor = KMSDRM_CreateCursor;
|
||||||
mouse->ShowCursor = KMSDRM_ShowCursor;
|
mouse->ShowCursor = KMSDRM_ShowCursor;
|
||||||
|
|
|
@ -54,7 +54,7 @@ int KMSDRM_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
so gbm dev isn't yet created when this is called, AND we can't alter the
|
so gbm dev isn't yet created when this is called, AND we can't alter the
|
||||||
call order in SDL_CreateWindow(). */
|
call order in SDL_CreateWindow(). */
|
||||||
#if 0
|
#if 0
|
||||||
NativeDisplayType display = (NativeDisplayType)_this->driverdata->gbm_dev;
|
NativeDisplayType display = (NativeDisplayType)_this->internal->gbm_dev;
|
||||||
return SDL_EGL_LoadLibrary(_this, path, display, EGL_PLATFORM_GBM_MESA);
|
return SDL_EGL_LoadLibrary(_this, path, display, EGL_PLATFORM_GBM_MESA);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -86,9 +86,9 @@ SDL_EGL_CreateContext_impl(KMSDRM)
|
||||||
|
|
||||||
int KMSDRM_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int KMSDRM_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windata = window->driverdata;
|
SDL_WindowData *windata = window->internal;
|
||||||
SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
|
SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
KMSDRM_FBInfo *fb_info;
|
KMSDRM_FBInfo *fb_info;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
|
@ -228,9 +228,9 @@ static int KMSDRM_Available(void)
|
||||||
|
|
||||||
static void KMSDRM_DeleteDevice(SDL_VideoDevice *device)
|
static void KMSDRM_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
if (device->driverdata) {
|
if (device->internal) {
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
device->driverdata = NULL;
|
device->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
|
@ -270,7 +270,7 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void)
|
||||||
viddata->devindex = devindex;
|
viddata->devindex = devindex;
|
||||||
viddata->drm_fd = -1;
|
viddata->drm_fd = -1;
|
||||||
|
|
||||||
device->driverdata = viddata;
|
device->internal = viddata;
|
||||||
|
|
||||||
/* Setup all functions which we can handle */
|
/* Setup all functions which we can handle */
|
||||||
device->VideoInit = KMSDRM_VideoInit;
|
device->VideoInit = KMSDRM_VideoInit;
|
||||||
|
@ -346,7 +346,7 @@ static void KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data)
|
||||||
|
|
||||||
KMSDRM_FBInfo *KMSDRM_FBFromBO(SDL_VideoDevice *_this, struct gbm_bo *bo)
|
KMSDRM_FBInfo *KMSDRM_FBFromBO(SDL_VideoDevice *_this, struct gbm_bo *bo)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
unsigned w, h;
|
unsigned w, h;
|
||||||
int ret, num_planes = 0;
|
int ret, num_planes = 0;
|
||||||
Uint32 format, strides[4] = { 0 }, handles[4] = { 0 }, offsets[4] = { 0 }, flags = 0;
|
Uint32 format, strides[4] = { 0 }, handles[4] = { 0 }, offsets[4] = { 0 }, flags = 0;
|
||||||
|
@ -424,7 +424,7 @@ static void KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, uns
|
||||||
SDL_bool KMSDRM_WaitPageflip(SDL_VideoDevice *_this, SDL_WindowData *windata)
|
SDL_bool KMSDRM_WaitPageflip(SDL_VideoDevice *_this, SDL_WindowData *windata)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
drmEventContext ev = { 0 };
|
drmEventContext ev = { 0 };
|
||||||
struct pollfd pfd = { 0 };
|
struct pollfd pfd = { 0 };
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -511,7 +511,7 @@ SDL_bool KMSDRM_WaitPageflip(SDL_VideoDevice *_this, SDL_WindowData *windata)
|
||||||
static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display, int width, int height)
|
static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display, int width, int height)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
drmModeConnector *connector = dispdata->connector;
|
drmModeConnector *connector = dispdata->connector;
|
||||||
|
|
||||||
const SDL_DisplayMode *closest;
|
const SDL_DisplayMode *closest;
|
||||||
|
@ -519,7 +519,7 @@ static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display,
|
||||||
|
|
||||||
closest = SDL_GetClosestFullscreenDisplayMode(display->id, width, height, 0.0f, SDL_FALSE);
|
closest = SDL_GetClosestFullscreenDisplayMode(display->id, width, height, 0.0f, SDL_FALSE);
|
||||||
if (closest) {
|
if (closest) {
|
||||||
const SDL_DisplayModeData *modedata = (const SDL_DisplayModeData *)closest->driverdata;
|
const SDL_DisplayModeData *modedata = closest->internal;
|
||||||
drm_mode = &connector->modes[modedata->mode_index];
|
drm_mode = &connector->modes[modedata->mode_index];
|
||||||
return drm_mode;
|
return drm_mode;
|
||||||
} else {
|
} else {
|
||||||
|
@ -532,7 +532,7 @@ static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display,
|
||||||
/* _this is a SDL_VideoDevice * */
|
/* _this is a SDL_VideoDevice * */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/* Deinitializes the driverdata of the SDL Displays in the SDL display list. */
|
/* Deinitializes the internal of the SDL Displays in the SDL display list. */
|
||||||
static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this)
|
static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_DisplayID *displays;
|
SDL_DisplayID *displays;
|
||||||
|
@ -544,7 +544,7 @@ static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this)
|
||||||
/* Iterate on the SDL Display list. */
|
/* Iterate on the SDL Display list. */
|
||||||
for (i = 0; displays[i]; ++i) {
|
for (i = 0; displays[i]; ++i) {
|
||||||
|
|
||||||
/* Get the driverdata for this display */
|
/* Get the internal for this display */
|
||||||
dispdata = SDL_GetDisplayDriverData(displays[i]);
|
dispdata = SDL_GetDisplayDriverData(displays[i]);
|
||||||
|
|
||||||
/* Free connector */
|
/* Free connector */
|
||||||
|
@ -772,7 +772,7 @@ static int KMSDRM_CrtcGetOrientation(uint32_t drm_fd, uint32_t crtc_id)
|
||||||
list of SDL Displays in _this->displays[] */
|
list of SDL Displays in _this->displays[] */
|
||||||
static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connector, drmModeRes *resources)
|
static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connector, drmModeRes *resources)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_DisplayData *dispdata = NULL;
|
SDL_DisplayData *dispdata = NULL;
|
||||||
SDL_VideoDisplay display = { 0 };
|
SDL_VideoDisplay display = { 0 };
|
||||||
SDL_DisplayModeData *modedata = NULL;
|
SDL_DisplayModeData *modedata = NULL;
|
||||||
|
@ -785,14 +785,14 @@ static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connecto
|
||||||
int i, j;
|
int i, j;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Reserve memory for the new display's driverdata. */
|
/* Reserve memory for the new display's internal. */
|
||||||
dispdata = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData));
|
dispdata = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData));
|
||||||
if (!dispdata) {
|
if (!dispdata) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize some of the members of the new display's driverdata
|
/* Initialize some of the members of the new display's internal
|
||||||
to sane values. */
|
to sane values. */
|
||||||
dispdata->cursor_bo = NULL;
|
dispdata->cursor_bo = NULL;
|
||||||
dispdata->cursor_bo_drm_fd = -1;
|
dispdata->cursor_bo_drm_fd = -1;
|
||||||
|
@ -915,7 +915,7 @@ static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connecto
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
/* Part 1: setup the SDL_Display driverdata. */
|
/* Part 1: setup the SDL_Display internal. */
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
|
||||||
/* Get the mode currently setup for this display,
|
/* Get the mode currently setup for this display,
|
||||||
|
@ -957,12 +957,12 @@ static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connecto
|
||||||
|
|
||||||
modedata->mode_index = mode_index;
|
modedata->mode_index = mode_index;
|
||||||
|
|
||||||
display.driverdata = dispdata;
|
display.internal = dispdata;
|
||||||
display.desktop_mode.w = dispdata->mode.hdisplay;
|
display.desktop_mode.w = dispdata->mode.hdisplay;
|
||||||
display.desktop_mode.h = dispdata->mode.vdisplay;
|
display.desktop_mode.h = dispdata->mode.vdisplay;
|
||||||
CalculateRefreshRate(&dispdata->mode, &display.desktop_mode.refresh_rate_numerator, &display.desktop_mode.refresh_rate_denominator);
|
CalculateRefreshRate(&dispdata->mode, &display.desktop_mode.refresh_rate_numerator, &display.desktop_mode.refresh_rate_denominator);
|
||||||
display.desktop_mode.format = SDL_PIXELFORMAT_ARGB8888;
|
display.desktop_mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||||
display.desktop_mode.driverdata = modedata;
|
display.desktop_mode.internal = modedata;
|
||||||
|
|
||||||
/* Add the display to the list of SDL displays. */
|
/* Add the display to the list of SDL displays. */
|
||||||
display_id = SDL_AddVideoDisplay(&display, SDL_FALSE);
|
display_id = SDL_AddVideoDisplay(&display, SDL_FALSE);
|
||||||
|
@ -1004,7 +1004,7 @@ cleanup:
|
||||||
static int KMSDRM_InitDisplays(SDL_VideoDevice *_this)
|
static int KMSDRM_InitDisplays(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
drmModeRes *resources = NULL;
|
drmModeRes *resources = NULL;
|
||||||
|
|
||||||
uint64_t async_pageflip = 0;
|
uint64_t async_pageflip = 0;
|
||||||
|
@ -1099,7 +1099,7 @@ cleanup:
|
||||||
*/
|
*/
|
||||||
static int KMSDRM_GBMInit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
static int KMSDRM_GBMInit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Reopen the FD! */
|
/* Reopen the FD! */
|
||||||
|
@ -1122,7 +1122,7 @@ static int KMSDRM_GBMInit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
||||||
/* Deinit the Vulkan-incompatible KMSDRM stuff. */
|
/* Deinit the Vulkan-incompatible KMSDRM stuff. */
|
||||||
static void KMSDRM_GBMDeinit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
static void KMSDRM_GBMDeinit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
|
|
||||||
/* Destroy GBM device. GBM surface is destroyed by DestroySurfaces(),
|
/* Destroy GBM device. GBM surface is destroyed by DestroySurfaces(),
|
||||||
already called when we get here. */
|
already called when we get here. */
|
||||||
|
@ -1142,8 +1142,8 @@ static void KMSDRM_GBMDeinit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
||||||
|
|
||||||
static void KMSDRM_DestroySurfaces(SDL_VideoDevice *_this, SDL_Window *window)
|
static void KMSDRM_DestroySurfaces(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_WindowData *windata = window->driverdata;
|
SDL_WindowData *windata = window->internal;
|
||||||
SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
|
SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1210,7 +1210,7 @@ static void KMSDRM_DestroySurfaces(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
static void KMSDRM_GetModeToSet(SDL_Window *window, drmModeModeInfo *out_mode)
|
static void KMSDRM_GetModeToSet(SDL_Window *window, drmModeModeInfo *out_mode)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
|
|
||||||
if (window->fullscreen_exclusive) {
|
if (window->fullscreen_exclusive) {
|
||||||
*out_mode = dispdata->fullscreen_mode;
|
*out_mode = dispdata->fullscreen_mode;
|
||||||
|
@ -1226,7 +1226,7 @@ static void KMSDRM_GetModeToSet(SDL_Window *window, drmModeModeInfo *out_mode)
|
||||||
|
|
||||||
static void KMSDRM_DirtySurfaces(SDL_Window *window)
|
static void KMSDRM_DirtySurfaces(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windata = window->driverdata;
|
SDL_WindowData *windata = window->internal;
|
||||||
drmModeModeInfo mode;
|
drmModeModeInfo mode;
|
||||||
|
|
||||||
/* Can't recreate EGL surfaces right now, need to wait until SwapWindow
|
/* Can't recreate EGL surfaces right now, need to wait until SwapWindow
|
||||||
|
@ -1244,10 +1244,10 @@ static void KMSDRM_DirtySurfaces(SDL_Window *window)
|
||||||
that we create here. */
|
that we create here. */
|
||||||
int KMSDRM_CreateSurfaces(SDL_VideoDevice *_this, SDL_Window *window)
|
int KMSDRM_CreateSurfaces(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_WindowData *windata = window->driverdata;
|
SDL_WindowData *windata = window->internal;
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
|
|
||||||
uint32_t surface_fmt = GBM_FORMAT_ARGB8888;
|
uint32_t surface_fmt = GBM_FORMAT_ARGB8888;
|
||||||
uint32_t surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
uint32_t surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
||||||
|
@ -1321,7 +1321,7 @@ cleanup:
|
||||||
static void KMSDRM_ReleaseVT(void *userdata)
|
static void KMSDRM_ReleaseVT(void *userdata)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata;
|
SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata;
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < viddata->num_windows; i++) {
|
for (i = 0; i < viddata->num_windows; i++) {
|
||||||
|
@ -1336,7 +1336,7 @@ static void KMSDRM_ReleaseVT(void *userdata)
|
||||||
static void KMSDRM_AcquireVT(void *userdata)
|
static void KMSDRM_AcquireVT(void *userdata)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata;
|
SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata;
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
KMSDRM_drmSetMaster(viddata->drm_fd);
|
KMSDRM_drmSetMaster(viddata->drm_fd);
|
||||||
|
@ -1353,7 +1353,7 @@ int KMSDRM_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()");
|
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()");
|
||||||
|
|
||||||
viddata->video_init = SDL_FALSE;
|
viddata->video_init = SDL_FALSE;
|
||||||
|
@ -1379,11 +1379,11 @@ int KMSDRM_VideoInit(SDL_VideoDevice *_this)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The driverdata pointers, like dispdata, viddata, windata, etc...
|
/* The internal pointers, like dispdata, viddata, windata, etc...
|
||||||
are freed by SDL internals, so not our job. */
|
are freed by SDL internals, so not our job. */
|
||||||
void KMSDRM_VideoQuit(SDL_VideoDevice *_this)
|
void KMSDRM_VideoQuit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
|
|
||||||
KMSDRM_DeinitDisplays(_this);
|
KMSDRM_DeinitDisplays(_this);
|
||||||
|
|
||||||
|
@ -1405,7 +1405,7 @@ void KMSDRM_VideoQuit(SDL_VideoDevice *_this)
|
||||||
/* Read modes from the connector modes, and store them in display->display_modes. */
|
/* Read modes from the connector modes, and store them in display->display_modes. */
|
||||||
int KMSDRM_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
int KMSDRM_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
drmModeConnector *conn = dispdata->connector;
|
drmModeConnector *conn = dispdata->connector;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1422,7 +1422,7 @@ int KMSDRM_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
mode.h = conn->modes[i].vdisplay;
|
mode.h = conn->modes[i].vdisplay;
|
||||||
CalculateRefreshRate(&conn->modes[i], &mode.refresh_rate_numerator, &mode.refresh_rate_denominator);
|
CalculateRefreshRate(&conn->modes[i], &mode.refresh_rate_numerator, &mode.refresh_rate_denominator);
|
||||||
mode.format = SDL_PIXELFORMAT_ARGB8888;
|
mode.format = SDL_PIXELFORMAT_ARGB8888;
|
||||||
mode.driverdata = modedata;
|
mode.internal = modedata;
|
||||||
|
|
||||||
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
||||||
SDL_free(modedata);
|
SDL_free(modedata);
|
||||||
|
@ -1436,9 +1436,9 @@ int KMSDRM_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL
|
||||||
/* Set the dispdata->mode to the new mode and leave actual modesetting
|
/* Set the dispdata->mode to the new mode and leave actual modesetting
|
||||||
pending to be done on SwapWindow() via drmModeSetCrtc() */
|
pending to be done on SwapWindow() via drmModeSetCrtc() */
|
||||||
|
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
|
SDL_DisplayModeData *modedata = mode->internal;
|
||||||
drmModeConnector *conn = dispdata->connector;
|
drmModeConnector *conn = dispdata->connector;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1464,7 +1464,7 @@ int KMSDRM_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL
|
||||||
|
|
||||||
void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windata = window->driverdata;
|
SDL_WindowData *windata = window->internal;
|
||||||
SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
|
SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
|
||||||
SDL_VideoData *viddata;
|
SDL_VideoData *viddata;
|
||||||
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
|
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
|
||||||
|
@ -1529,10 +1529,10 @@ void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Free the window driverdata. Bye bye, surface and buffer pointers! */
|
/* Free the window internal. Bye bye, surface and buffer pointers! */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
SDL_free(window->driverdata);
|
SDL_free(window->internal);
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
@ -1543,9 +1543,9 @@ void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windata = NULL;
|
SDL_WindowData *windata = NULL;
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->internal;
|
||||||
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
|
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
|
||||||
SDL_bool vulkan_mode = viddata->vulkan_mode; /* Do we have any Vulkan windows? */
|
SDL_bool vulkan_mode = viddata->vulkan_mode; /* Do we have any Vulkan windows? */
|
||||||
NativeDisplayType egl_display;
|
NativeDisplayType egl_display;
|
||||||
|
@ -1560,7 +1560,7 @@ int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
windata->viddata = viddata;
|
windata->viddata = viddata;
|
||||||
window->driverdata = windata;
|
window->internal = windata;
|
||||||
|
|
||||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, viddata->devindex);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER, viddata->devindex);
|
||||||
|
@ -1603,7 +1603,7 @@ int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti
|
||||||
If we let SDL_CreateWindow() load the lib, it would be loaded
|
If we let SDL_CreateWindow() load the lib, it would be loaded
|
||||||
before we call KMSDRM_GBMInit(), causing all GLES programs to fail. */
|
before we call KMSDRM_GBMInit(), causing all GLES programs to fail. */
|
||||||
if (!_this->egl_data) {
|
if (!_this->egl_data) {
|
||||||
egl_display = (NativeDisplayType)_this->driverdata->gbm_dev;
|
egl_display = (NativeDisplayType)_this->internal->gbm_dev;
|
||||||
if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) {
|
if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) {
|
||||||
/* Try again with OpenGL ES 2.0 */
|
/* Try again with OpenGL ES 2.0 */
|
||||||
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
||||||
|
@ -1689,14 +1689,14 @@ int KMSDRM_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
}
|
}
|
||||||
void KMSDRM_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
void KMSDRM_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
if (!viddata->vulkan_mode) {
|
if (!viddata->vulkan_mode) {
|
||||||
KMSDRM_DirtySurfaces(window);
|
KMSDRM_DirtySurfaces(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int KMSDRM_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen)
|
int KMSDRM_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
if (!viddata->vulkan_mode) {
|
if (!viddata->vulkan_mode) {
|
||||||
KMSDRM_DirtySurfaces(window);
|
KMSDRM_DirtySurfaces(window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,9 @@ struct SDL_DisplayData
|
||||||
drmModeCrtc *saved_crtc; /* CRTC to restore on quit */
|
drmModeCrtc *saved_crtc; /* CRTC to restore on quit */
|
||||||
SDL_bool saved_vrr;
|
SDL_bool saved_vrr;
|
||||||
|
|
||||||
/* DRM & GBM cursor stuff lives here, not in an SDL_Cursor's driverdata struct,
|
/* DRM & GBM cursor stuff lives here, not in an SDL_Cursor's internal struct,
|
||||||
because setting/unsetting up these is done on window creation/destruction,
|
because setting/unsetting up these is done on window creation/destruction,
|
||||||
where we may not have an SDL_Cursor at all (so no SDL_Cursor driverdata).
|
where we may not have an SDL_Cursor at all (so no SDL_Cursor internal).
|
||||||
There's only one cursor GBM BO because we only support one cursor. */
|
There's only one cursor GBM BO because we only support one cursor. */
|
||||||
struct gbm_bo *cursor_bo;
|
struct gbm_bo *cursor_bo;
|
||||||
int cursor_bo_drm_fd;
|
int cursor_bo_drm_fd;
|
||||||
|
@ -126,7 +126,7 @@ struct SDL_WindowData
|
||||||
SDL_VideoData *viddata;
|
SDL_VideoData *viddata;
|
||||||
/* SDL internals expect EGL surface to be here, and in KMSDRM the GBM surface is
|
/* SDL internals expect EGL surface to be here, and in KMSDRM the GBM surface is
|
||||||
what supports the EGL surface on the driver side, so all these surfaces and buffers
|
what supports the EGL surface on the driver side, so all these surfaces and buffers
|
||||||
are expected to be here, in the struct pointed by SDL_Window driverdata pointer:
|
are expected to be here, in the struct pointed by SDL_Window internal pointer:
|
||||||
this one. So don't try to move these to dispdata! */
|
this one. So don't try to move these to dispdata! */
|
||||||
struct gbm_surface *gs;
|
struct gbm_surface *gs;
|
||||||
struct gbm_bo *bo;
|
struct gbm_bo *bo;
|
||||||
|
|
|
@ -67,7 +67,7 @@ int SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window,
|
||||||
|
|
||||||
int SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
int SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
||||||
{
|
{
|
||||||
SDL_WindowData *drv_data = window->driverdata;
|
SDL_WindowData *drv_data = window->internal;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
u16 width, height;
|
u16 width, height;
|
||||||
void *framebuffer;
|
void *framebuffer;
|
||||||
|
|
|
@ -54,7 +54,7 @@ void N3DS_QuitTouch(void)
|
||||||
|
|
||||||
void N3DS_PollTouch(SDL_VideoDevice *_this)
|
void N3DS_PollTouch(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = (SDL_VideoData *)_this->driverdata;
|
SDL_VideoData *internal = (SDL_VideoData *)_this->internal;
|
||||||
touchPosition touch;
|
touchPosition touch;
|
||||||
SDL_Window *window;
|
SDL_Window *window;
|
||||||
SDL_VideoDisplay *display;
|
SDL_VideoDisplay *display;
|
||||||
|
@ -63,7 +63,7 @@ void N3DS_PollTouch(SDL_VideoDevice *_this)
|
||||||
hidTouchRead(&touch);
|
hidTouchRead(&touch);
|
||||||
pressed = (touch.px != 0 || touch.py != 0);
|
pressed = (touch.px != 0 || touch.py != 0);
|
||||||
|
|
||||||
display = SDL_GetVideoDisplay(driverdata->touch_display);
|
display = SDL_GetVideoDisplay(internal->touch_display);
|
||||||
window = display ? display->fullscreen_window : NULL;
|
window = display ? display->fullscreen_window : NULL;
|
||||||
|
|
||||||
if (pressed != was_pressed) {
|
if (pressed != was_pressed) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ static const struct
|
||||||
|
|
||||||
static void N3DS_DeleteDevice(SDL_VideoDevice *device)
|
static void N3DS_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ static SDL_VideoDevice *N3DS_CreateDevice(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = phdata;
|
device->internal = phdata;
|
||||||
|
|
||||||
device->VideoInit = N3DS_VideoInit;
|
device->VideoInit = N3DS_VideoInit;
|
||||||
device->VideoQuit = N3DS_VideoQuit;
|
device->VideoQuit = N3DS_VideoQuit;
|
||||||
|
@ -122,13 +122,13 @@ VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS
|
||||||
|
|
||||||
static int N3DS_VideoInit(SDL_VideoDevice *_this)
|
static int N3DS_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = (SDL_VideoData *)_this->driverdata;
|
SDL_VideoData *internal = (SDL_VideoData *)_this->internal;
|
||||||
|
|
||||||
gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false);
|
gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false);
|
||||||
hidInit();
|
hidInit();
|
||||||
|
|
||||||
driverdata->top_display = AddN3DSDisplay(GFX_TOP);
|
internal->top_display = AddN3DSDisplay(GFX_TOP);
|
||||||
driverdata->touch_display = AddN3DSDisplay(GFX_BOTTOM);
|
internal->touch_display = AddN3DSDisplay(GFX_BOTTOM);
|
||||||
|
|
||||||
N3DS_InitTouch();
|
N3DS_InitTouch();
|
||||||
N3DS_SwkbInit();
|
N3DS_SwkbInit();
|
||||||
|
@ -160,12 +160,12 @@ static int AddN3DSDisplay(gfxScreen_t screen)
|
||||||
mode.h = GSP_SCREEN_WIDTH;
|
mode.h = GSP_SCREEN_WIDTH;
|
||||||
mode.refresh_rate = 60.0f;
|
mode.refresh_rate = 60.0f;
|
||||||
mode.format = SDL_PIXELFORMAT_RGBA8888;
|
mode.format = SDL_PIXELFORMAT_RGBA8888;
|
||||||
mode.driverdata = modedata;
|
mode.internal = modedata;
|
||||||
modedata->fmt = GSP_RGBA8_OES;
|
modedata->fmt = GSP_RGBA8_OES;
|
||||||
|
|
||||||
display.name = (screen == GFX_TOP) ? "N3DS top screen" : "N3DS bottom screen";
|
display.name = (screen == GFX_TOP) ? "N3DS top screen" : "N3DS bottom screen";
|
||||||
display.desktop_mode = mode;
|
display.desktop_mode = mode;
|
||||||
display.driverdata = display_driver_data;
|
display.internal = display_driver_data;
|
||||||
|
|
||||||
return SDL_AddVideoDisplay(&display, SDL_FALSE);
|
return SDL_AddVideoDisplay(&display, SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ static void N3DS_VideoQuit(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
static int N3DS_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
static int N3DS_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *displaydata = display->driverdata;
|
SDL_DisplayData *displaydata = display->internal;
|
||||||
SDL_DisplayModeData *modedata;
|
SDL_DisplayModeData *modedata;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
int i;
|
int i;
|
||||||
|
@ -196,7 +196,7 @@ static int N3DS_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *displa
|
||||||
mode.h = GSP_SCREEN_WIDTH;
|
mode.h = GSP_SCREEN_WIDTH;
|
||||||
mode.refresh_rate = 60.0f;
|
mode.refresh_rate = 60.0f;
|
||||||
mode.format = format_map[i].pixfmt;
|
mode.format = format_map[i].pixfmt;
|
||||||
mode.driverdata = modedata;
|
mode.internal = modedata;
|
||||||
modedata->fmt = format_map[i].gspfmt;
|
modedata->fmt = format_map[i].gspfmt;
|
||||||
|
|
||||||
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
||||||
|
@ -209,8 +209,8 @@ static int N3DS_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *displa
|
||||||
|
|
||||||
static int N3DS_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
|
static int N3DS_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *displaydata = display->driverdata;
|
SDL_DisplayData *displaydata = display->internal;
|
||||||
SDL_DisplayModeData *modedata = mode->driverdata;
|
SDL_DisplayModeData *modedata = mode->internal;
|
||||||
|
|
||||||
gfxSetScreenFormat(displaydata->screen, modedata->fmt);
|
gfxSetScreenFormat(displaydata->screen, modedata->fmt);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -218,7 +218,7 @@ static int N3DS_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display
|
||||||
|
|
||||||
static int N3DS_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
static int N3DS_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driver_data = display->driverdata;
|
SDL_DisplayData *driver_data = display->internal;
|
||||||
|
|
||||||
if (!driver_data) {
|
if (!driver_data) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -240,7 +240,7 @@ static int N3DS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Pro
|
||||||
}
|
}
|
||||||
display_data = SDL_GetDisplayDriverDataForWindow(window);
|
display_data = SDL_GetDisplayDriverDataForWindow(window);
|
||||||
window_data->screen = display_data->screen;
|
window_data->screen = display_data->screen;
|
||||||
window->driverdata = window_data;
|
window->internal = window_data;
|
||||||
SDL_SetKeyboardFocus(window);
|
SDL_SetKeyboardFocus(window);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ static void N3DS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SDL_free(window->driverdata);
|
SDL_free(window->internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_N3DS */
|
#endif /* SDL_VIDEO_DRIVER_N3DS */
|
||||||
|
|
|
@ -44,7 +44,7 @@ int HandleWsEvent(SDL_VideoDevice *_this, const TWsEvent &aWsEvent);
|
||||||
|
|
||||||
void NGAGE_PumpEvents(SDL_VideoDevice *_this)
|
void NGAGE_PumpEvents(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
|
|
||||||
while (data->NGAGE_WsEventStatus != KRequestPending) {
|
while (data->NGAGE_WsEventStatus != KRequestPending) {
|
||||||
data->NGAGE_WsSession.GetEvent(data->NGAGE_WsEvent);
|
data->NGAGE_WsSession.GetEvent(data->NGAGE_WsEvent);
|
||||||
|
@ -149,7 +149,7 @@ static SDL_Scancode ConvertScancode(SDL_VideoDevice *_this, int key)
|
||||||
|
|
||||||
int HandleWsEvent(SDL_VideoDevice *_this, const TWsEvent &aWsEvent)
|
int HandleWsEvent(SDL_VideoDevice *_this, const TWsEvent &aWsEvent)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
int posted = 0;
|
int posted = 0;
|
||||||
|
|
||||||
switch (aWsEvent.Type()) {
|
switch (aWsEvent.Type()) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ void RedrawWindowL(SDL_VideoDevice *_this);
|
||||||
|
|
||||||
int SDL_NGAGE_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
int SDL_NGAGE_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
SDL_Surface *surface;
|
SDL_Surface *surface;
|
||||||
const SDL_PixelFormat surface_format = SDL_PIXELFORMAT_XRGB4444;
|
const SDL_PixelFormat surface_format = SDL_PIXELFORMAT_XRGB4444;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -199,7 +199,7 @@ int GetBpp(TDisplayMode displaymode)
|
||||||
|
|
||||||
void DrawBackground(SDL_VideoDevice *_this)
|
void DrawBackground(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
/* Draw background */
|
/* Draw background */
|
||||||
TUint16 *screenBuffer = (TUint16 *)phdata->NGAGE_FrameBuffer;
|
TUint16 *screenBuffer = (TUint16 *)phdata->NGAGE_FrameBuffer;
|
||||||
/* Draw black background */
|
/* Draw black background */
|
||||||
|
@ -208,7 +208,7 @@ void DrawBackground(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
void DirectDraw(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects, TUint16 *screenBuffer)
|
void DirectDraw(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects, TUint16 *screenBuffer)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
SDL_Surface *screen = (SDL_Surface *)SDL_GetWindowData(_this->windows, NGAGE_SURFACE);
|
SDL_Surface *screen = (SDL_Surface *)SDL_GetWindowData(_this->windows, NGAGE_SURFACE);
|
||||||
|
|
||||||
TInt i;
|
TInt i;
|
||||||
|
@ -333,7 +333,7 @@ void DirectDraw(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects, TUint16 *
|
||||||
|
|
||||||
void DirectUpdate(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects)
|
void DirectUpdate(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
|
|
||||||
if (!phdata->NGAGE_IsWindowFocused) {
|
if (!phdata->NGAGE_IsWindowFocused) {
|
||||||
SDL_PauseAudio(1);
|
SDL_PauseAudio(1);
|
||||||
|
@ -368,7 +368,7 @@ void DirectUpdate(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects)
|
||||||
|
|
||||||
void RedrawWindowL(SDL_VideoDevice *_this)
|
void RedrawWindowL(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
SDL_Surface *screen = (SDL_Surface *)SDL_GetWindowData(_this->windows, NGAGE_SURFACE);
|
SDL_Surface *screen = (SDL_Surface *)SDL_GetWindowData(_this->windows, NGAGE_SURFACE);
|
||||||
|
|
||||||
int w = screen->w;
|
int w = screen->w;
|
||||||
|
|
|
@ -54,7 +54,7 @@ static void NGAGE_VideoQuit(SDL_VideoDevice *_this);
|
||||||
|
|
||||||
static void NGAGE_DeleteDevice(SDL_VideoDevice *device)
|
static void NGAGE_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = device->driverdata;
|
SDL_VideoData *phdata = device->internal;
|
||||||
|
|
||||||
if (phdata) {
|
if (phdata) {
|
||||||
/* Free Epoc resources */
|
/* Free Epoc resources */
|
||||||
|
@ -129,7 +129,7 @@ static SDL_VideoDevice *NGAGE_CreateDevice(void)
|
||||||
device->DestroyWindow = NGAGE_DestroyWindow;
|
device->DestroyWindow = NGAGE_DestroyWindow;
|
||||||
|
|
||||||
/* N-Gage specific data */
|
/* N-Gage specific data */
|
||||||
device->driverdata = phdata;
|
device->internal = phdata;
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ int NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = ngage_window;
|
window->internal = ngage_window;
|
||||||
|
|
||||||
if (window->x == SDL_WINDOWPOS_UNDEFINED) {
|
if (window->x == SDL_WINDOWPOS_UNDEFINED) {
|
||||||
window->x = 0;
|
window->x = 0;
|
||||||
|
@ -59,13 +59,13 @@ int NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||||
|
|
||||||
void NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
NGAGE_Window *ngage_window = (NGAGE_Window *)window->driverdata;
|
NGAGE_Window *ngage_window = (NGAGE_Window *)window->internal;
|
||||||
|
|
||||||
if (ngage_window) {
|
if (ngage_window) {
|
||||||
SDL_free(ngage_window);
|
SDL_free(ngage_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -74,7 +74,7 @@ void NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
void DisableKeyBlocking(SDL_VideoDevice *_this)
|
void DisableKeyBlocking(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
TRawEvent event;
|
TRawEvent event;
|
||||||
|
|
||||||
event.Set((TRawEvent::TType) /*EDisableKeyBlock*/ 51);
|
event.Set((TRawEvent::TType) /*EDisableKeyBlock*/ 51);
|
||||||
|
@ -83,7 +83,7 @@ void DisableKeyBlocking(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
void ConstructWindowL(SDL_VideoDevice *_this)
|
void ConstructWindowL(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
TInt error;
|
TInt error;
|
||||||
|
|
||||||
error = phdata->NGAGE_WsSession.Connect();
|
error = phdata->NGAGE_WsSession.Connect();
|
||||||
|
|
|
@ -56,7 +56,7 @@ int OFFSCREEN_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
|
|
||||||
SDL_GLContext OFFSCREEN_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_GLContext OFFSCREEN_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *offscreen_window = window->driverdata;
|
SDL_WindowData *offscreen_window = window->internal;
|
||||||
|
|
||||||
SDL_GLContext context;
|
SDL_GLContext context;
|
||||||
context = SDL_EGL_CreateContext(_this, offscreen_window->egl_surface);
|
context = SDL_EGL_CreateContext(_this, offscreen_window->egl_surface);
|
||||||
|
@ -67,7 +67,7 @@ SDL_GLContext OFFSCREEN_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *w
|
||||||
int OFFSCREEN_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
int OFFSCREEN_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
if (window) {
|
if (window) {
|
||||||
EGLSurface egl_surface = window->driverdata->egl_surface;
|
EGLSurface egl_surface = window->internal->egl_surface;
|
||||||
return SDL_EGL_MakeCurrent(_this, egl_surface, context);
|
return SDL_EGL_MakeCurrent(_this, egl_surface, context);
|
||||||
} else {
|
} else {
|
||||||
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
||||||
|
@ -76,7 +76,7 @@ int OFFSCREEN_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_G
|
||||||
|
|
||||||
int OFFSCREEN_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int OFFSCREEN_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *offscreen_wind = window->driverdata;
|
SDL_WindowData *offscreen_wind = window->internal;
|
||||||
|
|
||||||
return SDL_EGL_SwapBuffers(_this, offscreen_wind->egl_surface);
|
return SDL_EGL_SwapBuffers(_this, offscreen_wind->egl_surface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ int OFFSCREEN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Prope
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = offscreen_window;
|
window->internal = offscreen_window;
|
||||||
|
|
||||||
if (window->x == SDL_WINDOWPOS_UNDEFINED) {
|
if (window->x == SDL_WINDOWPOS_UNDEFINED) {
|
||||||
window->x = 0;
|
window->x = 0;
|
||||||
|
@ -71,7 +71,7 @@ int OFFSCREEN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Prope
|
||||||
|
|
||||||
void OFFSCREEN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void OFFSCREEN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *offscreen_window = window->driverdata;
|
SDL_WindowData *offscreen_window = window->internal;
|
||||||
|
|
||||||
if (offscreen_window) {
|
if (offscreen_window) {
|
||||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||||
|
@ -80,7 +80,7 @@ void OFFSCREEN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
SDL_free(offscreen_window);
|
SDL_free(offscreen_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OFFSCREEN_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
void OFFSCREEN_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
|
@ -70,7 +70,7 @@ static EGLint height = 272;
|
||||||
SDL_GLContext PSP_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_GLContext PSP_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_WindowData *wdata = window->driverdata;
|
SDL_WindowData *wdata = window->internal;
|
||||||
|
|
||||||
EGLint attribs[32];
|
EGLint attribs[32];
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
|
@ -167,7 +167,7 @@ int PSP_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
int PSP_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
int PSP_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
EGLBoolean status;
|
EGLBoolean status;
|
||||||
|
|
||||||
if (phdata->egl_initialized != SDL_TRUE) {
|
if (phdata->egl_initialized != SDL_TRUE) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ static SDL_bool PSP_initialized = SDL_FALSE;
|
||||||
|
|
||||||
static void PSP_Destroy(SDL_VideoDevice *device)
|
static void PSP_Destroy(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ static SDL_VideoDevice *PSP_Create()
|
||||||
}
|
}
|
||||||
device->gl_data = gldata;
|
device->gl_data = gldata;
|
||||||
|
|
||||||
device->driverdata = phdata;
|
device->internal = phdata;
|
||||||
|
|
||||||
phdata->egl_initialized = SDL_TRUE;
|
phdata->egl_initialized = SDL_TRUE;
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ int PSP_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
window->driverdata = wdata;
|
window->internal = wdata;
|
||||||
|
|
||||||
SDL_SetKeyboardFocus(window);
|
SDL_SetKeyboardFocus(window);
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ SDL_FunctionPointer glGetProcAddress(SDL_VideoDevice *_this, const char *proc)
|
||||||
*/
|
*/
|
||||||
SDL_GLContext glCreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_GLContext glCreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
EGLContext context;
|
EGLContext context;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ int glSetSwapInterval(SDL_VideoDevice *_this, int interval)
|
||||||
int glSwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int glSwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
/* !!! FIXME: should we migrate this all over to use SDL_egl.c? */
|
/* !!! FIXME: should we migrate this all over to use SDL_egl.c? */
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1;
|
return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ int glMakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext cont
|
||||||
EGLSurface surface = NULL;
|
EGLSurface surface = NULL;
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
impl = (window_impl_t *)window->driverdata;
|
impl = (window_impl_t *)window->internal;
|
||||||
surface = impl->surface;
|
surface = impl->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ static int createWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = impl;
|
window->internal = impl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
@ -155,7 +155,7 @@ fail:
|
||||||
static int createWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window * window, SDL_PixelFormat * format,
|
static int createWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window * window, SDL_PixelFormat * format,
|
||||||
void ** pixels, int *pitch)
|
void ** pixels, int *pitch)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
screen_buffer_t buffer;
|
screen_buffer_t buffer;
|
||||||
|
|
||||||
// Get a pointer to the buffer's memory.
|
// Get a pointer to the buffer's memory.
|
||||||
|
@ -190,7 +190,7 @@ static int createWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window * window,
|
||||||
static int updateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects,
|
static int updateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects,
|
||||||
int numrects)
|
int numrects)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
screen_buffer_t buffer;
|
screen_buffer_t buffer;
|
||||||
|
|
||||||
if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS,
|
if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS,
|
||||||
|
@ -243,7 +243,7 @@ static void pumpEvents(SDL_VideoDevice *_this)
|
||||||
*/
|
*/
|
||||||
static void setWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
static void setWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
int size[2];
|
int size[2];
|
||||||
|
|
||||||
size[0] = window->floating.w;
|
size[0] = window->floating.w;
|
||||||
|
@ -260,7 +260,7 @@ static void setWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
*/
|
*/
|
||||||
static void showWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
static void showWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
const int visible = 1;
|
const int visible = 1;
|
||||||
|
|
||||||
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
|
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
|
||||||
|
@ -274,7 +274,7 @@ static void showWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
*/
|
*/
|
||||||
static void hideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
static void hideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
const int visible = 0;
|
const int visible = 0;
|
||||||
|
|
||||||
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
|
screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE,
|
||||||
|
@ -288,11 +288,11 @@ static void hideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
*/
|
*/
|
||||||
static void destroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
static void destroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
window_impl_t *impl = (window_impl_t *)window->driverdata;
|
window_impl_t *impl = (window_impl_t *)window->internal;
|
||||||
|
|
||||||
if (impl) {
|
if (impl) {
|
||||||
screen_destroy_window(impl->window);
|
screen_destroy_window(impl->window);
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ static SDL_VideoDevice *createDevice()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = NULL;
|
device->internal = NULL;
|
||||||
device->VideoInit = videoInit;
|
device->VideoInit = videoInit;
|
||||||
device->VideoQuit = videoQuit;
|
device->VideoQuit = videoQuit;
|
||||||
device->CreateSDLWindow = createWindow;
|
device->CreateSDLWindow = createWindow;
|
||||||
|
|
|
@ -92,7 +92,7 @@ static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
|
||||||
ret = vc_dispmanx_resource_write_data(curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect);
|
ret = vc_dispmanx_resource_write_data(curdata->resource, VC_IMAGE_ARGB8888, surface->pitch, surface->pixels, &dst_rect);
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
|
|
||||||
cursor->driverdata = curdata;
|
cursor->internal = curdata;
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ static int RPI_ShowCursor(SDL_Cursor *cursor)
|
||||||
|
|
||||||
if (cursor != global_cursor) {
|
if (cursor != global_cursor) {
|
||||||
if (global_cursor) {
|
if (global_cursor) {
|
||||||
curdata = (RPI_CursorData *)global_cursor->driverdata;
|
curdata = (RPI_CursorData *)global_cursor->internal;
|
||||||
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
|
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
|
||||||
update = vc_dispmanx_update_start(0);
|
update = vc_dispmanx_update_start(0);
|
||||||
SDL_assert(update);
|
SDL_assert(update);
|
||||||
|
@ -135,7 +135,7 @@ static int RPI_ShowCursor(SDL_Cursor *cursor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
curdata = (RPI_CursorData *)cursor->driverdata;
|
curdata = (RPI_CursorData *)cursor->internal;
|
||||||
if (!curdata) {
|
if (!curdata) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ static void RPI_FreeCursor(SDL_Cursor *cursor)
|
||||||
RPI_CursorData *curdata;
|
RPI_CursorData *curdata;
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
curdata = (RPI_CursorData *)cursor->driverdata;
|
curdata = (RPI_CursorData *)cursor->internal;
|
||||||
|
|
||||||
if (curdata) {
|
if (curdata) {
|
||||||
if (curdata->element != DISPMANX_NO_HANDLE) {
|
if (curdata->element != DISPMANX_NO_HANDLE) {
|
||||||
|
@ -204,7 +204,7 @@ static void RPI_FreeCursor(SDL_Cursor *cursor)
|
||||||
SDL_assert(ret == DISPMANX_SUCCESS);
|
SDL_assert(ret == DISPMANX_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(cursor->driverdata);
|
SDL_free(cursor->internal);
|
||||||
}
|
}
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
if (cursor == global_cursor) {
|
if (cursor == global_cursor) {
|
||||||
|
@ -222,11 +222,11 @@ static int RPI_WarpMouseGlobalGraphically(float x, float y)
|
||||||
VC_RECT_T src_rect;
|
VC_RECT_T src_rect;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
|
|
||||||
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
|
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->internal) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
curdata = (RPI_CursorData *)mouse->cur_cursor->driverdata;
|
curdata = (RPI_CursorData *)mouse->cur_cursor->internal;
|
||||||
if (curdata->element == DISPMANX_NO_HANDLE) {
|
if (curdata->element == DISPMANX_NO_HANDLE) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ static int RPI_WarpMouseGlobal(float x, float y)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
|
|
||||||
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
|
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->internal) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ struct _RPI_CursorData
|
||||||
int w, h;
|
int w, h;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SDL_RPI_CURSORDATA(curs) RPI_CursorData *curdata = (RPI_CursorData *)((curs) ? (curs)->driverdata : NULL)
|
#define SDL_RPI_CURSORDATA(curs) RPI_CursorData *curdata = (RPI_CursorData *)((curs) ? (curs)->internal : NULL)
|
||||||
|
|
||||||
extern void RPI_InitMouse(SDL_VideoDevice *_this);
|
extern void RPI_InitMouse(SDL_VideoDevice *_this);
|
||||||
extern void RPI_QuitMouse(SDL_VideoDevice *_this);
|
extern void RPI_QuitMouse(SDL_VideoDevice *_this);
|
||||||
|
|
|
@ -41,7 +41,7 @@ int RPI_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
|
|
||||||
int RPI_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int RPI_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *wdata = window->driverdata;
|
SDL_WindowData *wdata = window->internal;
|
||||||
|
|
||||||
if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
|
if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed.");
|
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed.");
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
static void RPI_Destroy(SDL_VideoDevice *device)
|
static void RPI_Destroy(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static SDL_VideoDevice *RPI_Create()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = phdata;
|
device->internal = phdata;
|
||||||
|
|
||||||
/* Setup amount of available displays */
|
/* Setup amount of available displays */
|
||||||
device->num_displays = 0;
|
device->num_displays = 0;
|
||||||
|
@ -181,7 +181,7 @@ static void AddDispManXDisplay(const int display_id)
|
||||||
|
|
||||||
data->dispman_display = handle;
|
data->dispman_display = handle;
|
||||||
|
|
||||||
display.driverdata = data;
|
display.internal = data;
|
||||||
|
|
||||||
SDL_AddVideoDisplay(&display, SDL_FALSE);
|
SDL_AddVideoDisplay(&display, SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
display = SDL_GetVideoDisplayForWindow(window);
|
display = SDL_GetVideoDisplayForWindow(window);
|
||||||
displaydata = display->driverdata;
|
displaydata = display->internal;
|
||||||
|
|
||||||
/* Windows have one size for now */
|
/* Windows have one size for now */
|
||||||
window->w = display->desktop_mode.w;
|
window->w = display->desktop_mode.w;
|
||||||
|
@ -305,7 +305,7 @@ int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
window->driverdata = wdata;
|
window->internal = wdata;
|
||||||
|
|
||||||
/* One window, it always has focus */
|
/* One window, it always has focus */
|
||||||
SDL_SetMouseFocus(window);
|
SDL_SetMouseFocus(window);
|
||||||
|
@ -317,7 +317,7 @@ int RPI_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
|
||||||
|
|
||||||
void RPI_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void RPI_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
|
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -339,7 +339,7 @@ void RPI_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,16 @@ static SDL_Scancode SDL_RISCOS_translate_keycode(int keycode)
|
||||||
|
|
||||||
void RISCOS_PollKeyboard(SDL_VideoDevice *_this)
|
void RISCOS_PollKeyboard(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
Uint8 key = 2;
|
Uint8 key = 2;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Check for key releases */
|
/* Check for key releases */
|
||||||
for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
|
for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
|
||||||
if (driverdata->key_pressed[i] != 255) {
|
if (internal->key_pressed[i] != 255) {
|
||||||
if ((_kernel_osbyte(129, driverdata->key_pressed[i] ^ 0xff, 0xff) & 0xff) != 255) {
|
if ((_kernel_osbyte(129, internal->key_pressed[i] ^ 0xff, 0xff) & 0xff) != 255) {
|
||||||
SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, driverdata->key_pressed[i], SDL_RISCOS_translate_keycode(driverdata->key_pressed[i]), SDL_RELEASED);
|
SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, internal->key_pressed[i], SDL_RISCOS_translate_keycode(internal->key_pressed[i]), SDL_RELEASED);
|
||||||
driverdata->key_pressed[i] = 255;
|
internal->key_pressed[i] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,11 +85,11 @@ void RISCOS_PollKeyboard(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
/* Record the press so we can detect release later. */
|
/* Record the press so we can detect release later. */
|
||||||
for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
|
for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
|
||||||
if (driverdata->key_pressed[i] == key) {
|
if (internal->key_pressed[i] == key) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (driverdata->key_pressed[i] == 255) {
|
if (internal->key_pressed[i] == 255) {
|
||||||
driverdata->key_pressed[i] = key;
|
internal->key_pressed[i] = key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ static const Uint8 mouse_button_map[] = {
|
||||||
|
|
||||||
void RISCOS_PollMouse(SDL_VideoDevice *_this)
|
void RISCOS_PollMouse(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
_kernel_swi_regs regs;
|
_kernel_swi_regs regs;
|
||||||
|
@ -129,22 +129,22 @@ void RISCOS_PollMouse(SDL_VideoDevice *_this)
|
||||||
SDL_SendMouseMotion(0, mouse->focus, SDL_DEFAULT_MOUSE_ID, SDL_FALSE, (float)x, (float)y);
|
SDL_SendMouseMotion(0, mouse->focus, SDL_DEFAULT_MOUSE_ID, SDL_FALSE, (float)x, (float)y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (driverdata->last_mouse_buttons != buttons) {
|
if (internal->last_mouse_buttons != buttons) {
|
||||||
for (i = 0; i < SDL_arraysize(mouse_button_map); i++) {
|
for (i = 0; i < SDL_arraysize(mouse_button_map); i++) {
|
||||||
SDL_SendMouseButton(0, mouse->focus, SDL_DEFAULT_MOUSE_ID, (buttons & (1 << i)) ? SDL_PRESSED : SDL_RELEASED, mouse_button_map[i]);
|
SDL_SendMouseButton(0, mouse->focus, SDL_DEFAULT_MOUSE_ID, (buttons & (1 << i)) ? SDL_PRESSED : SDL_RELEASED, mouse_button_map[i]);
|
||||||
}
|
}
|
||||||
driverdata->last_mouse_buttons = buttons;
|
internal->last_mouse_buttons = buttons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RISCOS_InitEvents(SDL_VideoDevice *_this)
|
int RISCOS_InitEvents(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
_kernel_swi_regs regs;
|
_kernel_swi_regs regs;
|
||||||
int i, status;
|
int i, status;
|
||||||
|
|
||||||
for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
|
for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) {
|
||||||
driverdata->key_pressed[i] = 255;
|
internal->key_pressed[i] = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = (_kernel_osbyte(202, 0, 255) & 0xFF);
|
status = (_kernel_osbyte(202, 0, 255) & 0xFF);
|
||||||
|
@ -153,7 +153,7 @@ int RISCOS_InitEvents(SDL_VideoDevice *_this)
|
||||||
SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) ? SDL_TRUE : SDL_FALSE);
|
SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) ? SDL_TRUE : SDL_FALSE);
|
||||||
|
|
||||||
_kernel_swi(OS_Mouse, ®s, ®s);
|
_kernel_swi(OS_Mouse, ®s, ®s);
|
||||||
driverdata->last_mouse_buttons = regs.r[2];
|
internal->last_mouse_buttons = regs.r[2];
|
||||||
|
|
||||||
/* Disable escape. */
|
/* Disable escape. */
|
||||||
_kernel_osbyte(229, 1, 0);
|
_kernel_osbyte(229, 1, 0);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
int RISCOS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
int RISCOS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
SDL_WindowData *driverdata = window->driverdata;
|
SDL_WindowData *internal = window->internal;
|
||||||
const char *sprite_name = "display";
|
const char *sprite_name = "display";
|
||||||
unsigned int sprite_mode;
|
unsigned int sprite_mode;
|
||||||
_kernel_oserror *error;
|
_kernel_oserror *error;
|
||||||
|
@ -50,7 +50,7 @@ int RISCOS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, S
|
||||||
mode = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(window));
|
mode = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(window));
|
||||||
if ((SDL_ISPIXELFORMAT_PACKED(mode->format) || SDL_ISPIXELFORMAT_ARRAY(mode->format))) {
|
if ((SDL_ISPIXELFORMAT_PACKED(mode->format) || SDL_ISPIXELFORMAT_ARRAY(mode->format))) {
|
||||||
*format = mode->format;
|
*format = mode->format;
|
||||||
sprite_mode = (unsigned int)mode->driverdata;
|
sprite_mode = (unsigned int)mode->internal;
|
||||||
} else {
|
} else {
|
||||||
*format = SDL_PIXELFORMAT_XBGR8888;
|
*format = SDL_PIXELFORMAT_XBGR8888;
|
||||||
sprite_mode = (1 | (90 << 1) | (90 << 14) | (6 << 27));
|
sprite_mode = (1 | (90 << 1) | (90 << 14) | (6 << 27));
|
||||||
|
@ -61,19 +61,19 @@ int RISCOS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, S
|
||||||
|
|
||||||
/* Allocate the sprite area */
|
/* Allocate the sprite area */
|
||||||
size = sizeof(sprite_area) + sizeof(sprite_header) + ((*pitch) * h);
|
size = sizeof(sprite_area) + sizeof(sprite_header) + ((*pitch) * h);
|
||||||
driverdata->fb_area = SDL_malloc(size);
|
internal->fb_area = SDL_malloc(size);
|
||||||
if (!driverdata->fb_area) {
|
if (!internal->fb_area) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
driverdata->fb_area->size = size;
|
internal->fb_area->size = size;
|
||||||
driverdata->fb_area->count = 0;
|
internal->fb_area->count = 0;
|
||||||
driverdata->fb_area->start = 16;
|
internal->fb_area->start = 16;
|
||||||
driverdata->fb_area->end = 16;
|
internal->fb_area->end = 16;
|
||||||
|
|
||||||
/* Create the actual image */
|
/* Create the actual image */
|
||||||
regs.r[0] = 256 + 15;
|
regs.r[0] = 256 + 15;
|
||||||
regs.r[1] = (int)driverdata->fb_area;
|
regs.r[1] = (int)internal->fb_area;
|
||||||
regs.r[2] = (int)sprite_name;
|
regs.r[2] = (int)sprite_name;
|
||||||
regs.r[3] = 0;
|
regs.r[3] = 0;
|
||||||
regs.r[4] = w;
|
regs.r[4] = w;
|
||||||
|
@ -81,25 +81,25 @@ int RISCOS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, S
|
||||||
regs.r[6] = sprite_mode;
|
regs.r[6] = sprite_mode;
|
||||||
error = _kernel_swi(OS_SpriteOp, ®s, ®s);
|
error = _kernel_swi(OS_SpriteOp, ®s, ®s);
|
||||||
if (error) {
|
if (error) {
|
||||||
SDL_free(driverdata->fb_area);
|
SDL_free(internal->fb_area);
|
||||||
return SDL_SetError("Unable to create sprite: %s (%i)", error->errmess, error->errnum);
|
return SDL_SetError("Unable to create sprite: %s (%i)", error->errmess, error->errnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
driverdata->fb_sprite = (sprite_header *)(((Uint8 *)driverdata->fb_area) + driverdata->fb_area->start);
|
internal->fb_sprite = (sprite_header *)(((Uint8 *)internal->fb_area) + internal->fb_area->start);
|
||||||
*pixels = ((Uint8 *)driverdata->fb_sprite) + driverdata->fb_sprite->image_offset;
|
*pixels = ((Uint8 *)internal->fb_sprite) + internal->fb_sprite->image_offset;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RISCOS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
int RISCOS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
||||||
{
|
{
|
||||||
SDL_WindowData *driverdata = window->driverdata;
|
SDL_WindowData *internal = window->internal;
|
||||||
_kernel_swi_regs regs;
|
_kernel_swi_regs regs;
|
||||||
_kernel_oserror *error;
|
_kernel_oserror *error;
|
||||||
|
|
||||||
regs.r[0] = 512 + 52;
|
regs.r[0] = 512 + 52;
|
||||||
regs.r[1] = (int)driverdata->fb_area;
|
regs.r[1] = (int)internal->fb_area;
|
||||||
regs.r[2] = (int)driverdata->fb_sprite;
|
regs.r[2] = (int)internal->fb_sprite;
|
||||||
regs.r[3] = 0; /* window->x << 1; */
|
regs.r[3] = 0; /* window->x << 1; */
|
||||||
regs.r[4] = 0; /* window->y << 1; */
|
regs.r[4] = 0; /* window->y << 1; */
|
||||||
regs.r[5] = 0x50;
|
regs.r[5] = 0x50;
|
||||||
|
@ -115,13 +115,13 @@ int RISCOS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, c
|
||||||
|
|
||||||
void RISCOS_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
void RISCOS_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *driverdata = window->driverdata;
|
SDL_WindowData *internal = window->internal;
|
||||||
|
|
||||||
if (driverdata->fb_area) {
|
if (internal->fb_area) {
|
||||||
SDL_free(driverdata->fb_area);
|
SDL_free(internal->fb_area);
|
||||||
driverdata->fb_area = NULL;
|
internal->fb_area = NULL;
|
||||||
}
|
}
|
||||||
driverdata->fb_sprite = NULL;
|
internal->fb_sprite = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
||||||
|
|
|
@ -218,8 +218,8 @@ int RISCOS_InitModes(SDL_VideoDevice *_this)
|
||||||
}
|
}
|
||||||
|
|
||||||
size = measure_mode_block(current_mode);
|
size = measure_mode_block(current_mode);
|
||||||
mode.driverdata = copy_memory(current_mode, size, size);
|
mode.internal = copy_memory(current_mode, size, size);
|
||||||
if (!mode.driverdata) {
|
if (!mode.internal) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,14 +267,14 @@ int RISCOS_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode.driverdata = convert_mode_block(pos + 4);
|
mode.internal = convert_mode_block(pos + 4);
|
||||||
if (!mode.driverdata) {
|
if (!mode.internal) {
|
||||||
SDL_free(block);
|
SDL_free(block);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
|
||||||
SDL_free(mode.driverdata);
|
SDL_free(mode.internal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ int RISCOS_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
regs.r[0] = 0;
|
regs.r[0] = 0;
|
||||||
regs.r[1] = (int)mode->driverdata;
|
regs.r[1] = (int)mode->internal;
|
||||||
error = _kernel_swi(OS_ScreenMode, ®s, ®s);
|
error = _kernel_swi(OS_ScreenMode, ®s, ®s);
|
||||||
if (error) {
|
if (error) {
|
||||||
return SDL_SetError("Unable to set the current screen mode: %s (%i)", error->errmess, error->errnum);
|
return SDL_SetError("Unable to set the current screen mode: %s (%i)", error->errmess, error->errnum);
|
||||||
|
|
|
@ -33,7 +33,7 @@ static SDL_Cursor *RISCOS_CreateDefaultCursor()
|
||||||
SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor));
|
SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
/* NULL is used to indicate the default cursor */
|
/* NULL is used to indicate the default cursor */
|
||||||
cursor->driverdata = NULL;
|
cursor->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
|
|
|
@ -46,7 +46,7 @@ static void RISCOS_VideoQuit(SDL_VideoDevice *_this);
|
||||||
|
|
||||||
static void RISCOS_DeleteDevice(SDL_VideoDevice *device)
|
static void RISCOS_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = data;
|
device->internal = data;
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
device->VideoInit = RISCOS_VideoInit;
|
device->VideoInit = RISCOS_VideoInit;
|
||||||
|
@ -101,7 +101,7 @@ VideoBootStrap RISCOS_bootstrap = {
|
||||||
|
|
||||||
static int RISCOS_VideoInit(SDL_VideoDevice *_this)
|
static int RISCOS_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
|
|
||||||
if (RISCOS_InitEvents(_this) < 0) {
|
if (RISCOS_InitEvents(_this) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -30,31 +30,27 @@
|
||||||
|
|
||||||
int RISCOS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
int RISCOS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
SDL_WindowData *driverdata;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
driverdata = (SDL_WindowData *)SDL_calloc(1, sizeof(*driverdata));
|
data = (SDL_WindowData *)SDL_calloc(1, sizeof(*data));
|
||||||
if (!driverdata) {
|
if (!data) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
driverdata->window = window;
|
data->window = window;
|
||||||
|
|
||||||
SDL_SetMouseFocus(window);
|
SDL_SetMouseFocus(window);
|
||||||
|
|
||||||
/* All done! */
|
/* All done! */
|
||||||
window->driverdata = driverdata;
|
window->internal = data;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RISCOS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void RISCOS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *driverdata = window->driverdata;
|
if (window->internal) {
|
||||||
|
SDL_free(window->internal);
|
||||||
if (!driverdata) {
|
window->internal = NULL;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(driverdata);
|
|
||||||
window->driverdata = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
||||||
|
|
|
@ -491,7 +491,7 @@ static UIImage *SDL_LoadLaunchImageNamed(NSString *name, int screenh)
|
||||||
if (_this) {
|
if (_this) {
|
||||||
SDL_Window *window = NULL;
|
SDL_Window *window = NULL;
|
||||||
for (window = _this->windows; window != NULL; window = window->next) {
|
for (window = _this->windows; window != NULL; window = window->next) {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
if (data != nil) {
|
if (data != nil) {
|
||||||
return data.uiwindow;
|
return data.uiwindow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ void UIKit_InitClipboard(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
#ifndef SDL_PLATFORM_TVOS
|
#ifndef SDL_PLATFORM_TVOS
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitVideoData *data = (__bridge SDL_UIKitVideoData *)_this->driverdata;
|
SDL_UIKitVideoData *data = (__bridge SDL_UIKitVideoData *)_this->internal;
|
||||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
id observer = [center addObserverForName:UIPasteboardChangedNotification
|
id observer = [center addObserverForName:UIPasteboardChangedNotification
|
||||||
|
@ -91,7 +91,7 @@ void UIKit_InitClipboard(SDL_VideoDevice *_this)
|
||||||
void UIKit_QuitClipboard(SDL_VideoDevice *_this)
|
void UIKit_QuitClipboard(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitVideoData *data = (__bridge SDL_UIKitVideoData *)_this->driverdata;
|
SDL_UIKitVideoData *data = (__bridge SDL_UIKitVideoData *)_this->internal;
|
||||||
|
|
||||||
if (data.pasteboardObserver != nil) {
|
if (data.pasteboardObserver != nil) {
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:data.pasteboardObserver];
|
[[NSNotificationCenter defaultCenter] removeObserver:data.pasteboardObserver];
|
||||||
|
|
|
@ -93,7 +93,7 @@ static BOOL UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messag
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageboxdata->window) {
|
if (messageboxdata->window) {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)messageboxdata->window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)messageboxdata->window->internal;
|
||||||
window = data.uiwindow;
|
window = data.uiwindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
SDL_MetalView UIKit_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_MetalView UIKit_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
CGFloat scale = 1.0;
|
CGFloat scale = 1.0;
|
||||||
SDL_uikitmetalview *metalview;
|
SDL_uikitmetalview *metalview;
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ static int UIKit_AllocateDisplayModeData(SDL_DisplayMode *mode,
|
||||||
data.uiscreenmode = uiscreenmode;
|
data.uiscreenmode = uiscreenmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode->driverdata = (void *)CFBridgingRetain(data);
|
mode->internal = (void *)CFBridgingRetain(data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -122,9 +122,9 @@ static int UIKit_AllocateDisplayModeData(SDL_DisplayMode *mode,
|
||||||
|
|
||||||
static void UIKit_FreeDisplayModeData(SDL_DisplayMode *mode)
|
static void UIKit_FreeDisplayModeData(SDL_DisplayMode *mode)
|
||||||
{
|
{
|
||||||
if (mode->driverdata != NULL) {
|
if (mode->internal != NULL) {
|
||||||
CFRelease(mode->driverdata);
|
CFRelease(mode->internal);
|
||||||
mode->driverdata = NULL;
|
mode->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ int UIKit_AddDisplay(UIScreen *uiscreen, SDL_bool send_event)
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
display.driverdata = (SDL_DisplayData *)CFBridgingRetain(data);
|
display.internal = (SDL_DisplayData *)CFBridgingRetain(data);
|
||||||
if (SDL_AddVideoDisplay(&display, send_event) == 0) {
|
if (SDL_AddVideoDisplay(&display, send_event) == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ int UIKit_AddDisplay(SDL_bool send_event){
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
display.driverdata = (SDL_DisplayData *)CFBridgingRetain(data);
|
display.internal = (SDL_DisplayData *)CFBridgingRetain(data);
|
||||||
if (SDL_AddVideoDisplay(&display, send_event) == 0) {
|
if (SDL_AddVideoDisplay(&display, send_event) == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -317,11 +317,11 @@ void UIKit_DelDisplay(UIScreen *uiscreen, SDL_bool send_event)
|
||||||
if (displays) {
|
if (displays) {
|
||||||
for (i = 0; displays[i]; ++i) {
|
for (i = 0; displays[i]; ++i) {
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displays[i]);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displays[i]);
|
||||||
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
|
|
||||||
if (data && data.uiscreen == uiscreen) {
|
if (data && data.uiscreen == uiscreen) {
|
||||||
CFRelease(display->driverdata);
|
CFRelease(display->internal);
|
||||||
display->driverdata = NULL;
|
display->internal = NULL;
|
||||||
SDL_DelVideoDisplay(displays[i], send_event);
|
SDL_DelVideoDisplay(displays[i], send_event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ int UIKit_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
#ifndef SDL_PLATFORM_VISIONOS
|
#ifndef SDL_PLATFORM_VISIONOS
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
|
|
||||||
SDL_bool isLandscape = UIKit_IsDisplayLandscape(data.uiscreen);
|
SDL_bool isLandscape = UIKit_IsDisplayLandscape(data.uiscreen);
|
||||||
SDL_bool addRotation = (data.uiscreen == [UIScreen mainScreen]);
|
SDL_bool addRotation = (data.uiscreen == [UIScreen mainScreen]);
|
||||||
|
@ -408,10 +408,10 @@ int UIKit_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_
|
||||||
{
|
{
|
||||||
#ifndef SDL_PLATFORM_VISIONOS
|
#ifndef SDL_PLATFORM_VISIONOS
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
|
|
||||||
#ifndef SDL_PLATFORM_TVOS
|
#ifndef SDL_PLATFORM_TVOS
|
||||||
SDL_UIKitDisplayModeData *modedata = (__bridge SDL_UIKitDisplayModeData *)mode->driverdata;
|
SDL_UIKitDisplayModeData *modedata = (__bridge SDL_UIKitDisplayModeData *)mode->internal;
|
||||||
[data.uiscreen setCurrentMode:modedata.uiscreenmode];
|
[data.uiscreen setCurrentMode:modedata.uiscreenmode];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ int UIKit_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_
|
||||||
int UIKit_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
int UIKit_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
#ifdef SDL_PLATFORM_VISIONOS
|
#ifdef SDL_PLATFORM_VISIONOS
|
||||||
CGRect frame = CGRectMake(0, 0, SDL_XR_SCREENWIDTH, SDL_XR_SCREENHEIGHT);
|
CGRect frame = CGRectMake(0, 0, SDL_XR_SCREENWIDTH, SDL_XR_SCREENHEIGHT);
|
||||||
#else
|
#else
|
||||||
|
@ -477,9 +477,9 @@ void UIKit_QuitModes(SDL_VideoDevice *_this)
|
||||||
UIKit_FreeDisplayModeData(mode);
|
UIKit_FreeDisplayModeData(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display->driverdata != NULL) {
|
if (display->internal != NULL) {
|
||||||
CFRelease(display->driverdata);
|
CFRelease(display->internal);
|
||||||
display->driverdata = NULL;
|
display->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ SDL_GLContext UIKit_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDLEAGLContext *context = nil;
|
SDLEAGLContext *context = nil;
|
||||||
SDL_uikitopenglview *view;
|
SDL_uikitopenglview *view;
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
CGRect frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen);
|
CGRect frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen);
|
||||||
EAGLSharegroup *sharegroup = nil;
|
EAGLSharegroup *sharegroup = nil;
|
||||||
CGFloat scale = 1.0;
|
CGFloat scale = 1.0;
|
||||||
|
@ -184,7 +184,7 @@ SDL_GLContext UIKit_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We return a +1'd context. The window's driverdata owns the view (via
|
/* We return a +1'd context. The window's internal owns the view (via
|
||||||
* MakeCurrent.) */
|
* MakeCurrent.) */
|
||||||
return (SDL_GLContext)CFBridgingRetain(context);
|
return (SDL_GLContext)CFBridgingRetain(context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ static void UIKit_VideoQuit(SDL_VideoDevice *_this);
|
||||||
static void UIKit_DeleteDevice(SDL_VideoDevice *device)
|
static void UIKit_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
if (device->driverdata){
|
if (device->internal){
|
||||||
CFRelease(device->driverdata);
|
CFRelease(device->internal);
|
||||||
}
|
}
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void)
|
||||||
|
|
||||||
data = [SDL_UIKitVideoData new];
|
data = [SDL_UIKitVideoData new];
|
||||||
|
|
||||||
device->driverdata = (SDL_VideoData *)CFBridgingRetain(data);
|
device->internal = (SDL_VideoData *)CFBridgingRetain(data);
|
||||||
device->system_theme = UIKit_GetSystemTheme();
|
device->system_theme = UIKit_GetSystemTheme();
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -212,7 +212,7 @@ CGRect UIKit_ComputeViewFrame(SDL_Window *window){
|
||||||
#else
|
#else
|
||||||
CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen)
|
CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen)
|
||||||
{
|
{
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
CGRect frame = screen.bounds;
|
CGRect frame = screen.bounds;
|
||||||
|
|
||||||
/* Use the UIWindow bounds instead of the UIScreen bounds, when possible.
|
/* Use the UIWindow bounds instead of the UIScreen bounds, when possible.
|
||||||
|
@ -256,7 +256,7 @@ void UIKit_ForceUpdateHomeIndicator(void)
|
||||||
/* Force the main SDL window to re-evaluate home indicator state */
|
/* Force the main SDL window to re-evaluate home indicator state */
|
||||||
SDL_Window *focus = SDL_GetKeyboardFocus();
|
SDL_Window *focus = SDL_GetKeyboardFocus();
|
||||||
if (focus) {
|
if (focus) {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)focus->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)focus->internal;
|
||||||
if (data != nil) {
|
if (data != nil) {
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
||||||
|
|
|
@ -103,7 +103,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
||||||
/* Remove ourself from the old window. */
|
/* Remove ourself from the old window. */
|
||||||
if (sdlwindow) {
|
if (sdlwindow) {
|
||||||
SDL_uikitview *view = nil;
|
SDL_uikitview *view = nil;
|
||||||
data = (__bridge SDL_UIKitWindowData *)sdlwindow->driverdata;
|
data = (__bridge SDL_UIKitWindowData *)sdlwindow->internal;
|
||||||
|
|
||||||
[data.views removeObject:self];
|
[data.views removeObject:self];
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
||||||
|
|
||||||
/* Add ourself to the new window. */
|
/* Add ourself to the new window. */
|
||||||
if (window) {
|
if (window) {
|
||||||
data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
|
|
||||||
/* Make sure the SDL window has a strong reference to this view. */
|
/* Make sure the SDL window has a strong reference to this view. */
|
||||||
[data.views addObject:self];
|
[data.views addObject:self];
|
||||||
|
|
|
@ -165,7 +165,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
||||||
#ifdef SDL_PLATFORM_VISIONOS
|
#ifdef SDL_PLATFORM_VISIONOS
|
||||||
displayLink.preferredFramesPerSecond = 90 / animationInterval; //TODO: Get frame max frame rate on visionOS
|
displayLink.preferredFramesPerSecond = 90 / animationInterval; //TODO: Get frame max frame rate on visionOS
|
||||||
#elif defined(__IPHONE_10_3)
|
#elif defined(__IPHONE_10_3)
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
|
|
||||||
if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] && data != nil && data.uiwindow != nil && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) {
|
if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] && data != nil && data.uiwindow != nil && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) {
|
||||||
displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval;
|
displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval;
|
||||||
|
@ -511,7 +511,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
||||||
|
|
||||||
- (void)updateKeyboard
|
- (void)updateKeyboard
|
||||||
{
|
{
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *) window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *) window->internal;
|
||||||
|
|
||||||
CGAffineTransform t = self.view.transform;
|
CGAffineTransform t = self.view.transform;
|
||||||
CGPoint offset = CGPointMake(0.0, 0.0);
|
CGPoint offset = CGPointMake(0.0, 0.0);
|
||||||
|
@ -581,12 +581,12 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
||||||
|
|
||||||
static SDL_uikitviewcontroller *GetWindowViewController(SDL_Window *window)
|
static SDL_uikitviewcontroller *GetWindowViewController(SDL_Window *window)
|
||||||
{
|
{
|
||||||
if (!window || !window->driverdata) {
|
if (!window || !window->internal) {
|
||||||
SDL_SetError("Invalid window");
|
SDL_SetError("Invalid window");
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
|
|
||||||
return data.viewcontroller;
|
return data.viewcontroller;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
|
static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_UIKitDisplayData *displaydata = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *displaydata = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
SDL_uikitview *view;
|
SDL_uikitview *view;
|
||||||
|
|
||||||
#ifdef SDL_PLATFORM_VISIONOS
|
#ifdef SDL_PLATFORM_VISIONOS
|
||||||
|
@ -99,7 +99,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = (SDL_WindowData *)CFBridgingRetain(data);
|
window->internal = (SDL_WindowData *)CFBridgingRetain(data);
|
||||||
|
|
||||||
data.uiwindow = uiwindow;
|
data.uiwindow = uiwindow;
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ int UIKit_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *data = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
SDL_Window *other;
|
SDL_Window *other;
|
||||||
|
|
||||||
/* We currently only handle a single window per display on iOS */
|
/* We currently only handle a single window per display on iOS */
|
||||||
|
@ -179,7 +179,7 @@ int UIKit_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||||
}
|
}
|
||||||
bestmode = SDL_GetClosestFullscreenDisplayMode(display->id, window->w, window->h, 0.0f, include_high_density_modes);
|
bestmode = SDL_GetClosestFullscreenDisplayMode(display->id, window->w, window->h, 0.0f, include_high_density_modes);
|
||||||
if (bestmode) {
|
if (bestmode) {
|
||||||
SDL_UIKitDisplayModeData *modedata = (__bridge SDL_UIKitDisplayModeData *)bestmode->driverdata;
|
SDL_UIKitDisplayModeData *modedata = (__bridge SDL_UIKitDisplayModeData *)bestmode->internal;
|
||||||
[data.uiscreen setCurrentMode:modedata.uiscreenmode];
|
[data.uiscreen setCurrentMode:modedata.uiscreenmode];
|
||||||
|
|
||||||
/* desktop_mode doesn't change here (the higher level will
|
/* desktop_mode doesn't change here (the higher level will
|
||||||
|
@ -224,7 +224,7 @@ int UIKit_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
|
||||||
void UIKit_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
void UIKit_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
data.viewcontroller.title = @(window->title);
|
data.viewcontroller.title = @(window->title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,12 +232,12 @@ void UIKit_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void UIKit_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void UIKit_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
[data.uiwindow makeKeyAndVisible];
|
[data.uiwindow makeKeyAndVisible];
|
||||||
|
|
||||||
/* Make this window the current mouse focus for touch input */
|
/* Make this window the current mouse focus for touch input */
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_UIKitDisplayData *displaydata = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
SDL_UIKitDisplayData *displaydata = (__bridge SDL_UIKitDisplayData *)display->internal;
|
||||||
#ifndef SDL_PLATFORM_VISIONOS
|
#ifndef SDL_PLATFORM_VISIONOS
|
||||||
if (displaydata.uiscreen == [UIScreen mainScreen])
|
if (displaydata.uiscreen == [UIScreen mainScreen])
|
||||||
#endif
|
#endif
|
||||||
|
@ -251,7 +251,7 @@ void UIKit_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void UIKit_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void UIKit_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
data.uiwindow.hidden = YES;
|
data.uiwindow.hidden = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ void UIKit_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
static void UIKit_UpdateWindowBorder(SDL_VideoDevice *_this, SDL_Window *window)
|
static void UIKit_UpdateWindowBorder(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
SDL_uikitviewcontroller *viewcontroller = data.viewcontroller;
|
SDL_uikitviewcontroller *viewcontroller = data.viewcontroller;
|
||||||
|
|
||||||
#if !defined(SDL_PLATFORM_TVOS) && !defined(SDL_PLATFORM_VISIONOS)
|
#if !defined(SDL_PLATFORM_TVOS) && !defined(SDL_PLATFORM_VISIONOS)
|
||||||
|
@ -320,7 +320,7 @@ void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
#ifndef SDL_PLATFORM_TVOS
|
#ifndef SDL_PLATFORM_TVOS
|
||||||
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
SDL_uikitviewcontroller *viewcontroller = data.viewcontroller;
|
SDL_uikitviewcontroller *viewcontroller = data.viewcontroller;
|
||||||
if (@available(iOS 14.0, *)) {
|
if (@available(iOS 14.0, *)) {
|
||||||
[viewcontroller setNeedsUpdateOfPrefersPointerLocked];
|
[viewcontroller setNeedsUpdateOfPrefersPointerLocked];
|
||||||
|
@ -333,8 +333,8 @@ void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void UIKit_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void UIKit_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
if (window->driverdata != NULL) {
|
if (window->internal != NULL) {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
NSArray *views = nil;
|
NSArray *views = nil;
|
||||||
|
|
||||||
[data.viewcontroller stopAnimation];
|
[data.viewcontroller stopAnimation];
|
||||||
|
@ -354,8 +354,8 @@ void UIKit_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
data.uiwindow.rootViewController = nil;
|
data.uiwindow.rootViewController = nil;
|
||||||
data.uiwindow.hidden = YES;
|
data.uiwindow.hidden = YES;
|
||||||
|
|
||||||
CFRelease(window->driverdata);
|
CFRelease(window->internal);
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ void UIKit_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
|
void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *windata = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *windata = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
UIView *view = windata.viewcontroller.view;
|
UIView *view = windata.viewcontroller.view;
|
||||||
CGSize size = view.bounds.size;
|
CGSize size = view.bounds.size;
|
||||||
CGFloat scale = 1.0;
|
CGFloat scale = 1.0;
|
||||||
|
@ -394,7 +394,7 @@ UIKit_GetSupportedOrientations(SDL_Window *window)
|
||||||
NSUInteger orientationMask = 0;
|
NSUInteger orientationMask = 0;
|
||||||
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
UIApplication *app = [UIApplication sharedApplication];
|
UIApplication *app = [UIApplication sharedApplication];
|
||||||
|
|
||||||
/* Get all possible valid orientations. If the app delegate doesn't tell
|
/* Get all possible valid orientations. If the app delegate doesn't tell
|
||||||
|
@ -455,12 +455,12 @@ UIKit_GetSupportedOrientations(SDL_Window *window)
|
||||||
|
|
||||||
int SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam)
|
int SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam)
|
||||||
{
|
{
|
||||||
if (!window || !window->driverdata) {
|
if (!window || !window->internal) {
|
||||||
return SDL_SetError("Invalid window");
|
return SDL_SetError("Invalid window");
|
||||||
}
|
}
|
||||||
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
|
||||||
[data.viewcontroller setAnimationCallback:interval
|
[data.viewcontroller setAnimationCallback:interval
|
||||||
callback:callback
|
callback:callback
|
||||||
callbackParam:callbackParam];
|
callbackParam:callbackParam];
|
||||||
|
|
|
@ -65,7 +65,7 @@ void vita_gpu_free(SceUID uid)
|
||||||
|
|
||||||
int VITA_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
int VITA_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
SceDisplayFrameBuf framebuf;
|
SceDisplayFrameBuf framebuf;
|
||||||
|
|
||||||
*format = SDL_PIXELFORMAT_ABGR8888;
|
*format = SDL_PIXELFORMAT_ABGR8888;
|
||||||
|
@ -101,7 +101,7 @@ int VITA_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, con
|
||||||
|
|
||||||
void VITA_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
void VITA_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
/* The window wasn't fully initialized */
|
/* The window wasn't fully initialized */
|
||||||
|
|
|
@ -93,7 +93,7 @@ SDL_GLContext VITA_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
_this->gl_config.minor_version = 0;
|
_this->gl_config.minor_version = 0;
|
||||||
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
||||||
|
|
||||||
context = SDL_EGL_CreateContext(_this, window->driverdata->egl_surface);
|
context = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
|
||||||
|
|
||||||
if (context != NULL) {
|
if (context != NULL) {
|
||||||
FB_WIDTH = window->w;
|
FB_WIDTH = window->w;
|
||||||
|
|
|
@ -80,7 +80,7 @@ static EGLint height = 544;
|
||||||
SDL_GLContext VITA_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_GLContext VITA_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
|
|
||||||
SDL_WindowData *wdata = window->driverdata;
|
SDL_WindowData *wdata = window->internal;
|
||||||
|
|
||||||
EGLint attribs[32];
|
EGLint attribs[32];
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
|
@ -193,7 +193,7 @@ int VITA_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
int VITA_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
int VITA_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
SDL_VideoData *phdata = _this->driverdata;
|
SDL_VideoData *phdata = _this->internal;
|
||||||
EGLBoolean status;
|
EGLBoolean status;
|
||||||
|
|
||||||
if (phdata->egl_initialized != SDL_TRUE) {
|
if (phdata->egl_initialized != SDL_TRUE) {
|
||||||
|
|
|
@ -69,13 +69,13 @@ int VITA_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
|
|
||||||
SDL_GLContext VITA_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_GLContext VITA_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
return SDL_EGL_CreateContext(_this, window->driverdata->egl_surface);
|
return SDL_EGL_CreateContext(_this, window->internal->egl_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
int VITA_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
int VITA_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
if (window && context) {
|
if (window && context) {
|
||||||
return SDL_EGL_MakeCurrent(_this, window->driverdata->egl_surface, context);
|
return SDL_EGL_MakeCurrent(_this, window->internal->egl_surface, context);
|
||||||
} else {
|
} else {
|
||||||
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -83,11 +83,11 @@ int VITA_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLCont
|
||||||
|
|
||||||
int VITA_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int VITA_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
if (videodata->ime_active) {
|
if (videodata->ime_active) {
|
||||||
sceImeUpdate();
|
sceImeUpdate();
|
||||||
}
|
}
|
||||||
return SDL_EGL_SwapBuffers(_this, window->driverdata->egl_surface);
|
return SDL_EGL_SwapBuffers(_this, window->internal->egl_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR */
|
#endif /* SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR */
|
||||||
|
|
|
@ -55,7 +55,7 @@ SDL_Window *Vita_Window;
|
||||||
|
|
||||||
static void VITA_Destroy(SDL_VideoDevice *device)
|
static void VITA_Destroy(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ static SDL_VideoDevice *VITA_Create()
|
||||||
#endif
|
#endif
|
||||||
phdata->ime_active = SDL_FALSE;
|
phdata->ime_active = SDL_FALSE;
|
||||||
|
|
||||||
device->driverdata = phdata;
|
device->internal = phdata;
|
||||||
|
|
||||||
/* Setup amount of available displays and current display */
|
/* Setup amount of available displays and current display */
|
||||||
device->num_displays = 0;
|
device->num_displays = 0;
|
||||||
|
@ -234,7 +234,7 @@ int VITA_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
window->driverdata = wdata;
|
window->internal = wdata;
|
||||||
|
|
||||||
// Vita can only have one window
|
// Vita can only have one window
|
||||||
if (Vita_Window) {
|
if (Vita_Window) {
|
||||||
|
@ -328,13 +328,13 @@ void VITA_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
if (data) {
|
if (data) {
|
||||||
// TODO: should we destroy egl context? No one sane should recreate ogl window as non-ogl
|
// TODO: should we destroy egl context? No one sane should recreate ogl window as non-ogl
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
Vita_Window = NULL;
|
Vita_Window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ void VITA_ImeEventHandler(void *arg, const SceImeEventData *e)
|
||||||
|
|
||||||
void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
SceInt32 res;
|
SceInt32 res;
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_VITA_PVR
|
#ifdef SDL_VIDEO_VITA_PVR
|
||||||
|
@ -475,7 +475,7 @@ void VITA_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void VITA_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
void VITA_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
#ifndef SDL_VIDEO_VITA_PVR
|
#ifndef SDL_VIDEO_VITA_PVR
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
|
|
||||||
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
|
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ void VITA_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
SDL_bool VITA_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_bool VITA_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
#ifdef SDL_VIDEO_VITA_PVR
|
#ifdef SDL_VIDEO_VITA_PVR
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
return videodata->ime_active;
|
return videodata->ime_active;
|
||||||
#else
|
#else
|
||||||
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
|
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
|
||||||
|
@ -507,7 +507,7 @@ SDL_bool VITA_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void VITA_PumpEvents(SDL_VideoDevice *_this)
|
void VITA_PumpEvents(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
#ifndef SDL_VIDEO_VITA_PVR
|
#ifndef SDL_VIDEO_VITA_PVR
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_this->suspend_screensaver) {
|
if (_this->suspend_screensaver) {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
static void VIVANTE_Destroy(SDL_VideoDevice *device)
|
static void VIVANTE_Destroy(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_free(device->driverdata);
|
SDL_free(device->internal);
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ static SDL_VideoDevice *VIVANTE_Create()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = data;
|
device->internal = data;
|
||||||
|
|
||||||
/* Setup amount of available displays */
|
/* Setup amount of available displays */
|
||||||
device->num_displays = 0;
|
device->num_displays = 0;
|
||||||
|
@ -116,7 +116,7 @@ VideoBootStrap VIVANTE_bootstrap = {
|
||||||
|
|
||||||
static int VIVANTE_AddVideoDisplays(SDL_VideoDevice *_this)
|
static int VIVANTE_AddVideoDisplays(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
SDL_VideoDisplay display;
|
SDL_VideoDisplay display;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
SDL_DisplayData *data;
|
SDL_DisplayData *data;
|
||||||
|
@ -156,7 +156,7 @@ static int VIVANTE_AddVideoDisplays(SDL_VideoDevice *_this)
|
||||||
SDL_zero(display);
|
SDL_zero(display);
|
||||||
display.name = VIVANTE_GetDisplayName(_this);
|
display.name = VIVANTE_GetDisplayName(_this);
|
||||||
display.desktop_mode = mode;
|
display.desktop_mode = mode;
|
||||||
display.driverdata = data;
|
display.internal = data;
|
||||||
if (SDL_AddVideoDisplay(&display, SDL_FALSE) == 0) {
|
if (SDL_AddVideoDisplay(&display, SDL_FALSE) == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ static int VIVANTE_AddVideoDisplays(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
int VIVANTE_VideoInit(SDL_VideoDevice *_this)
|
int VIVANTE_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||||
videodata->vdk_private = vdkInitialize();
|
videodata->vdk_private = vdkInitialize();
|
||||||
|
@ -217,7 +217,7 @@ int VIVANTE_VideoInit(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
void VIVANTE_VideoQuit(SDL_VideoDevice *_this)
|
void VIVANTE_VideoQuit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
|
|
||||||
#ifdef SDL_INPUT_LINUXEV
|
#ifdef SDL_INPUT_LINUXEV
|
||||||
SDL_EVDEV_Quit();
|
SDL_EVDEV_Quit();
|
||||||
|
@ -240,7 +240,7 @@ void VIVANTE_VideoQuit(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
SDL_DisplayData *displaydata;
|
SDL_DisplayData *displaydata;
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup driver data for this window */
|
/* Setup driver data for this window */
|
||||||
window->driverdata = data;
|
window->internal = data;
|
||||||
|
|
||||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||||
SDL_SetPointerProperty(props, SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER, displaydata->native_display);
|
SDL_SetPointerProperty(props, SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER, displaydata->native_display);
|
||||||
|
@ -286,10 +286,10 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
|
||||||
|
|
||||||
void VIVANTE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void VIVANTE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
SDL_WindowData *data;
|
SDL_WindowData *data;
|
||||||
|
|
||||||
data = window->driverdata;
|
data = window->internal;
|
||||||
if (data) {
|
if (data) {
|
||||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||||
if (data->egl_surface != EGL_NO_SURFACE) {
|
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||||
|
@ -307,13 +307,13 @@ void VIVANTE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
}
|
}
|
||||||
window->driverdata = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VIVANTE_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
void VIVANTE_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
vdkSetWindowTitle(data->native_window, window->title);
|
vdkSetWindowTitle(data->native_window, window->title);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ void VIVANTE_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void VIVANTE_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void VIVANTE_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
vdkShowWindow(data->native_window);
|
vdkShowWindow(data->native_window);
|
||||||
#endif
|
#endif
|
||||||
SDL_SetMouseFocus(window);
|
SDL_SetMouseFocus(window);
|
||||||
|
@ -342,7 +342,7 @@ void VIVANTE_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
void VIVANTE_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
void VIVANTE_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
vdkHideWindow(data->native_window);
|
vdkHideWindow(data->native_window);
|
||||||
#endif
|
#endif
|
||||||
SDL_SetMouseFocus(NULL);
|
SDL_SetMouseFocus(NULL);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
int Wayland_SetClipboardData(SDL_VideoDevice *_this)
|
int Wayland_SetClipboardData(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *video_data = _this->driverdata;
|
SDL_VideoData *video_data = _this->internal;
|
||||||
SDL_WaylandDataDevice *data_device = NULL;
|
SDL_WaylandDataDevice *data_device = NULL;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ int Wayland_SetClipboardData(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
void *Wayland_GetClipboardData(SDL_VideoDevice *_this, const char *mime_type, size_t *length)
|
void *Wayland_GetClipboardData(SDL_VideoDevice *_this, const char *mime_type, size_t *length)
|
||||||
{
|
{
|
||||||
SDL_VideoData *video_data = _this->driverdata;
|
SDL_VideoData *video_data = _this->internal;
|
||||||
SDL_WaylandDataDevice *data_device = NULL;
|
SDL_WaylandDataDevice *data_device = NULL;
|
||||||
void *buffer = NULL;
|
void *buffer = NULL;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ void *Wayland_GetClipboardData(SDL_VideoDevice *_this, const char *mime_type, si
|
||||||
|
|
||||||
SDL_bool Wayland_HasClipboardData(SDL_VideoDevice *_this, const char *mime_type)
|
SDL_bool Wayland_HasClipboardData(SDL_VideoDevice *_this, const char *mime_type)
|
||||||
{
|
{
|
||||||
SDL_VideoData *video_data = _this->driverdata;
|
SDL_VideoData *video_data = _this->internal;
|
||||||
SDL_WaylandDataDevice *data_device = NULL;
|
SDL_WaylandDataDevice *data_device = NULL;
|
||||||
SDL_bool result = SDL_FALSE;
|
SDL_bool result = SDL_FALSE;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ const char **Wayland_GetTextMimeTypes(SDL_VideoDevice *_this, size_t *num_mime_t
|
||||||
|
|
||||||
int Wayland_SetPrimarySelectionText(SDL_VideoDevice *_this, const char *text)
|
int Wayland_SetPrimarySelectionText(SDL_VideoDevice *_this, const char *text)
|
||||||
{
|
{
|
||||||
SDL_VideoData *video_data = _this->driverdata;
|
SDL_VideoData *video_data = _this->internal;
|
||||||
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
||||||
int status = -1;
|
int status = -1;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ int Wayland_SetPrimarySelectionText(SDL_VideoDevice *_this, const char *text)
|
||||||
|
|
||||||
char *Wayland_GetPrimarySelectionText(SDL_VideoDevice *_this)
|
char *Wayland_GetPrimarySelectionText(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *video_data = _this->driverdata;
|
SDL_VideoData *video_data = _this->internal;
|
||||||
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
||||||
char *text = NULL;
|
char *text = NULL;
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
|
@ -155,7 +155,7 @@ char *Wayland_GetPrimarySelectionText(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
SDL_bool Wayland_HasPrimarySelectionText(SDL_VideoDevice *_this)
|
SDL_bool Wayland_HasPrimarySelectionText(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *video_data = _this->driverdata;
|
SDL_VideoData *video_data = _this->internal;
|
||||||
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
||||||
SDL_bool result = SDL_FALSE;
|
SDL_bool result = SDL_FALSE;
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ static struct wl_callback_listener sync_listener = {
|
||||||
|
|
||||||
void Wayland_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window)
|
void Wayland_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *d = _this->driverdata;
|
SDL_VideoData *d = _this->internal;
|
||||||
|
|
||||||
/* Queue a sync event to unblock the event queue fd if it's empty and being waited on.
|
/* Queue a sync event to unblock the event queue fd if it's empty and being waited on.
|
||||||
* TODO: Maybe use a pipe to avoid the compositor roundtrip?
|
* TODO: Maybe use a pipe to avoid the compositor roundtrip?
|
||||||
|
@ -376,7 +376,7 @@ static int dispatch_queued_events(SDL_VideoData *viddata)
|
||||||
|
|
||||||
int Wayland_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
int Wayland_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
||||||
{
|
{
|
||||||
SDL_VideoData *d = _this->driverdata;
|
SDL_VideoData *d = _this->internal;
|
||||||
struct SDL_WaylandInput *input = d->input;
|
struct SDL_WaylandInput *input = d->input;
|
||||||
SDL_bool key_repeat_active = SDL_FALSE;
|
SDL_bool key_repeat_active = SDL_FALSE;
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ int Wayland_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
||||||
|
|
||||||
void Wayland_PumpEvents(SDL_VideoDevice *_this)
|
void Wayland_PumpEvents(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *d = _this->driverdata;
|
SDL_VideoData *d = _this->internal;
|
||||||
struct SDL_WaylandInput *input = d->input;
|
struct SDL_WaylandInput *input = d->input;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -1893,10 +1893,10 @@ SDL_WaylandDataSource *Wayland_data_source_create(SDL_VideoDevice *_this)
|
||||||
SDL_VideoData *driver_data = NULL;
|
SDL_VideoData *driver_data = NULL;
|
||||||
struct wl_data_source *id = NULL;
|
struct wl_data_source *id = NULL;
|
||||||
|
|
||||||
if (!_this || !_this->driverdata) {
|
if (!_this || !_this->internal) {
|
||||||
SDL_SetError("Video driver uninitialized");
|
SDL_SetError("Video driver uninitialized");
|
||||||
} else {
|
} else {
|
||||||
driver_data = _this->driverdata;
|
driver_data = _this->internal;
|
||||||
|
|
||||||
if (driver_data->data_device_manager) {
|
if (driver_data->data_device_manager) {
|
||||||
id = wl_data_device_manager_create_data_source(
|
id = wl_data_device_manager_create_data_source(
|
||||||
|
@ -1926,10 +1926,10 @@ SDL_WaylandPrimarySelectionSource *Wayland_primary_selection_source_create(SDL_V
|
||||||
SDL_VideoData *driver_data = NULL;
|
SDL_VideoData *driver_data = NULL;
|
||||||
struct zwp_primary_selection_source_v1 *id = NULL;
|
struct zwp_primary_selection_source_v1 *id = NULL;
|
||||||
|
|
||||||
if (!_this || !_this->driverdata) {
|
if (!_this || !_this->internal) {
|
||||||
SDL_SetError("Video driver uninitialized");
|
SDL_SetError("Video driver uninitialized");
|
||||||
} else {
|
} else {
|
||||||
driver_data = _this->driverdata;
|
driver_data = _this->internal;
|
||||||
|
|
||||||
if (driver_data->primary_selection_device_manager) {
|
if (driver_data->primary_selection_device_manager) {
|
||||||
id = zwp_primary_selection_device_manager_v1_create_source(
|
id = zwp_primary_selection_device_manager_v1_create_source(
|
||||||
|
@ -3129,7 +3129,7 @@ static const struct zwp_locked_pointer_v1_listener locked_pointer_listener = {
|
||||||
|
|
||||||
int Wayland_input_lock_pointer(struct SDL_WaylandInput *input, SDL_Window *window)
|
int Wayland_input_lock_pointer(struct SDL_WaylandInput *input, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *w = window->driverdata;
|
SDL_WindowData *w = window->internal;
|
||||||
SDL_VideoData *d = input->display;
|
SDL_VideoData *d = input->display;
|
||||||
|
|
||||||
if (!d->pointer_constraints || !input->pointer) {
|
if (!d->pointer_constraints || !input->pointer) {
|
||||||
|
@ -3157,7 +3157,7 @@ int Wayland_input_lock_pointer(struct SDL_WaylandInput *input, SDL_Window *windo
|
||||||
|
|
||||||
int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input, SDL_Window *window)
|
int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *w = window->driverdata;
|
SDL_WindowData *w = window->internal;
|
||||||
|
|
||||||
if (w->locked_pointer) {
|
if (w->locked_pointer) {
|
||||||
zwp_locked_pointer_v1_destroy(w->locked_pointer);
|
zwp_locked_pointer_v1_destroy(w->locked_pointer);
|
||||||
|
@ -3172,7 +3172,7 @@ int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input, SDL_Window *win
|
||||||
|
|
||||||
static void pointer_confine_destroy(SDL_Window *window)
|
static void pointer_confine_destroy(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *w = window->driverdata;
|
SDL_WindowData *w = window->internal;
|
||||||
if (w->confined_pointer) {
|
if (w->confined_pointer) {
|
||||||
zwp_confined_pointer_v1_destroy(w->confined_pointer);
|
zwp_confined_pointer_v1_destroy(w->confined_pointer);
|
||||||
w->confined_pointer = NULL;
|
w->confined_pointer = NULL;
|
||||||
|
@ -3263,7 +3263,7 @@ static const struct zwp_confined_pointer_v1_listener confined_pointer_listener =
|
||||||
|
|
||||||
int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *window)
|
int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *w = window->driverdata;
|
SDL_WindowData *w = window->internal;
|
||||||
SDL_VideoData *d = input->display;
|
SDL_VideoData *d = input->display;
|
||||||
struct zwp_confined_pointer_v1 *confined_pointer;
|
struct zwp_confined_pointer_v1 *confined_pointer;
|
||||||
struct wl_region *confine_rect;
|
struct wl_region *confine_rect;
|
||||||
|
@ -3337,7 +3337,7 @@ int Wayland_input_unconfine_pointer(struct SDL_WaylandInput *input, SDL_Window *
|
||||||
|
|
||||||
int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input)
|
int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input)
|
||||||
{
|
{
|
||||||
SDL_WindowData *w = window->driverdata;
|
SDL_WindowData *w = window->internal;
|
||||||
SDL_VideoData *d = input->display;
|
SDL_VideoData *d = input->display;
|
||||||
|
|
||||||
if (!d->key_inhibitor_manager) {
|
if (!d->key_inhibitor_manager) {
|
||||||
|
@ -3358,7 +3358,7 @@ int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *inp
|
||||||
|
|
||||||
int Wayland_input_ungrab_keyboard(SDL_Window *window)
|
int Wayland_input_ungrab_keyboard(SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *w = window->driverdata;
|
SDL_WindowData *w = window->internal;
|
||||||
|
|
||||||
if (w->key_inhibitor) {
|
if (w->key_inhibitor) {
|
||||||
zwp_keyboard_shortcuts_inhibitor_v1_destroy(w->key_inhibitor);
|
zwp_keyboard_shortcuts_inhibitor_v1_destroy(w->key_inhibitor);
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
int Wayland_InitKeyboard(SDL_VideoDevice *_this)
|
int Wayland_InitKeyboard(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
if (!driverdata->text_input_manager) {
|
if (!internal->text_input_manager) {
|
||||||
SDL_IME_Init();
|
SDL_IME_Init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,8 +44,8 @@ int Wayland_InitKeyboard(SDL_VideoDevice *_this)
|
||||||
void Wayland_QuitKeyboard(SDL_VideoDevice *_this)
|
void Wayland_QuitKeyboard(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
#ifdef SDL_USE_IME
|
#ifdef SDL_USE_IME
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
if (!driverdata->text_input_manager) {
|
if (!internal->text_input_manager) {
|
||||||
SDL_IME_Quit();
|
SDL_IME_Quit();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,10 +53,10 @@ void Wayland_QuitKeyboard(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
struct SDL_WaylandInput *input = driverdata->input;
|
struct SDL_WaylandInput *input = internal->input;
|
||||||
|
|
||||||
if (driverdata->text_input_manager) {
|
if (internal->text_input_manager) {
|
||||||
if (input && input->text_input) {
|
if (input && input->text_input) {
|
||||||
const SDL_Rect *rect = &input->text_input->cursor_rect;
|
const SDL_Rect *rect = &input->text_input->cursor_rect;
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ int Wayland_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
int Wayland_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
int Wayland_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
struct SDL_WaylandInput *input = driverdata->input;
|
struct SDL_WaylandInput *input = internal->input;
|
||||||
|
|
||||||
if (driverdata->text_input_manager) {
|
if (internal->text_input_manager) {
|
||||||
if (input && input->text_input) {
|
if (input && input->text_input) {
|
||||||
zwp_text_input_v3_disable(input->text_input->text_input);
|
zwp_text_input_v3_disable(input->text_input->text_input);
|
||||||
zwp_text_input_v3_commit(input->text_input->text_input);
|
zwp_text_input_v3_commit(input->text_input->text_input);
|
||||||
|
@ -112,9 +112,9 @@ int Wayland_StopTextInput(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
int Wayland_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window)
|
int Wayland_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
if (driverdata->text_input_manager) {
|
if (internal->text_input_manager) {
|
||||||
struct SDL_WaylandInput *input = driverdata->input;
|
struct SDL_WaylandInput *input = internal->input;
|
||||||
if (input && input->text_input) {
|
if (input && input->text_input) {
|
||||||
if (!SDL_RectsEqual(&window->text_input_rect, &input->text_input->cursor_rect)) {
|
if (!SDL_RectsEqual(&window->text_input_rect, &input->text_input->cursor_rect)) {
|
||||||
SDL_copyp(&input->text_input->cursor_rect, &window->text_input_rect);
|
SDL_copyp(&input->text_input->cursor_rect, &window->text_input_rect);
|
||||||
|
@ -142,9 +142,9 @@ SDL_bool Wayland_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
|
||||||
* _only_ way to get text input. So, in addition to checking for the text
|
* _only_ way to get text input. So, in addition to checking for the text
|
||||||
* input protocol, make sure we don't have any physical keyboards either.
|
* input protocol, make sure we don't have any physical keyboards either.
|
||||||
*/
|
*/
|
||||||
SDL_VideoData *driverdata = _this->driverdata;
|
SDL_VideoData *internal = _this->internal;
|
||||||
SDL_bool haskeyboard = (driverdata->input != NULL) && (driverdata->input->keyboard != NULL);
|
SDL_bool haskeyboard = (internal->input != NULL) && (internal->input->keyboard != NULL);
|
||||||
SDL_bool hastextmanager = (driverdata->text_input_manager != NULL);
|
SDL_bool hastextmanager = (internal->text_input_manager != NULL);
|
||||||
return !haskeyboard && hastextmanager;
|
return !haskeyboard && hastextmanager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, struct Wayland_C
|
||||||
/* Nothing to see here, bail. */
|
/* Nothing to see here, bail. */
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
focusdata = focus->driverdata;
|
focusdata = focus->internal;
|
||||||
|
|
||||||
/* Cursors use integer scaling. */
|
/* Cursors use integer scaling. */
|
||||||
*scale = SDL_ceilf(focusdata->windowed_scale_factor);
|
*scale = SDL_ceilf(focusdata->windowed_scale_factor);
|
||||||
|
@ -423,17 +423,17 @@ static SDL_Cursor *Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot
|
||||||
SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor));
|
SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *wd = vd->driverdata;
|
SDL_VideoData *wd = vd->internal;
|
||||||
struct Wayland_CursorData *data = SDL_calloc(1, sizeof(struct Wayland_CursorData));
|
struct Wayland_CursorData *data = SDL_calloc(1, sizeof(struct Wayland_CursorData));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cursor->driverdata = (void *)data;
|
cursor->internal = (void *)data;
|
||||||
|
|
||||||
/* Allocate shared memory buffer for this cursor */
|
/* Allocate shared memory buffer for this cursor */
|
||||||
if (Wayland_AllocSHMBuffer(surface->w, surface->h, &data->cursor_data.custom) != 0) {
|
if (Wayland_AllocSHMBuffer(surface->w, surface->h, &data->cursor_data.custom) != 0) {
|
||||||
SDL_free(cursor->driverdata);
|
SDL_free(cursor->internal);
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ static SDL_Cursor *Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot
|
||||||
|
|
||||||
static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id)
|
static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = SDL_GetVideoDevice()->driverdata;
|
SDL_VideoData *data = SDL_GetVideoDevice()->internal;
|
||||||
SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor));
|
SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor));
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
struct Wayland_CursorData *cdata = SDL_calloc(1, sizeof(struct Wayland_CursorData));
|
struct Wayland_CursorData *cdata = SDL_calloc(1, sizeof(struct Wayland_CursorData));
|
||||||
|
@ -465,7 +465,7 @@ static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id)
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cursor->driverdata = (void *)cdata;
|
cursor->internal = (void *)cdata;
|
||||||
|
|
||||||
/* The surface is only necessary if the cursor shape manager is not present.
|
/* The surface is only necessary if the cursor shape manager is not present.
|
||||||
*
|
*
|
||||||
|
@ -514,13 +514,13 @@ static void Wayland_FreeCursor(SDL_Cursor *cursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Probably not a cursor we own */
|
/* Probably not a cursor we own */
|
||||||
if (!cursor->driverdata) {
|
if (!cursor->internal) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Wayland_FreeCursorData((struct Wayland_CursorData *)cursor->driverdata);
|
Wayland_FreeCursorData((struct Wayland_CursorData *)cursor->internal);
|
||||||
|
|
||||||
SDL_free(cursor->driverdata);
|
SDL_free(cursor->internal);
|
||||||
SDL_free(cursor);
|
SDL_free(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ static void Wayland_SetSystemCursorShape(struct SDL_WaylandInput *input, SDL_Sys
|
||||||
static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *d = vd->driverdata;
|
SDL_VideoData *d = vd->internal;
|
||||||
struct SDL_WaylandInput *input = d->input;
|
struct SDL_WaylandInput *input = d->input;
|
||||||
struct wl_pointer *pointer = d->pointer;
|
struct wl_pointer *pointer = d->pointer;
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
@ -617,7 +617,7 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
struct Wayland_CursorData *data = cursor->driverdata;
|
struct Wayland_CursorData *data = cursor->internal;
|
||||||
|
|
||||||
/* TODO: High-DPI custom cursors? -flibit */
|
/* TODO: High-DPI custom cursors? -flibit */
|
||||||
if (data->is_system_cursor) {
|
if (data->is_system_cursor) {
|
||||||
|
@ -684,8 +684,8 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor)
|
||||||
static int Wayland_WarpMouse(SDL_Window *window, float x, float y)
|
static int Wayland_WarpMouse(SDL_Window *window, float x, float y)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *d = vd->driverdata;
|
SDL_VideoData *d = vd->internal;
|
||||||
SDL_WindowData *wind = window->driverdata;
|
SDL_WindowData *wind = window->internal;
|
||||||
struct SDL_WaylandInput *input = d->input;
|
struct SDL_WaylandInput *input = d->input;
|
||||||
|
|
||||||
if (input->cursor_visible || (input->warp_emulation_prohibited && !d->relative_mouse_mode)) {
|
if (input->cursor_visible || (input->warp_emulation_prohibited && !d->relative_mouse_mode)) {
|
||||||
|
@ -730,7 +730,7 @@ static int Wayland_WarpMouse(SDL_Window *window, float x, float y)
|
||||||
static int Wayland_WarpMouseGlobal(float x, float y)
|
static int Wayland_WarpMouseGlobal(float x, float y)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *d = vd->driverdata;
|
SDL_VideoData *d = vd->internal;
|
||||||
struct SDL_WaylandInput *input = d->input;
|
struct SDL_WaylandInput *input = d->input;
|
||||||
SDL_WindowData *wind = input->pointer_focus;
|
SDL_WindowData *wind = input->pointer_focus;
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ static int Wayland_WarpMouseGlobal(float x, float y)
|
||||||
static int Wayland_SetRelativeMouseMode(SDL_bool enabled)
|
static int Wayland_SetRelativeMouseMode(SDL_bool enabled)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *data = vd->driverdata;
|
SDL_VideoData *data = vd->internal;
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
/* Disable mouse warp emulation if it's enabled. */
|
/* Disable mouse warp emulation if it's enabled. */
|
||||||
|
@ -804,7 +804,7 @@ static SDL_MouseButtonFlags SDLCALL Wayland_GetGlobalMouseState(float *x, float
|
||||||
#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */
|
#if 0 /* TODO RECONNECT: See waylandvideo.c for more information! */
|
||||||
static void Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata)
|
static void Wayland_RecreateCursor(SDL_Cursor *cursor, SDL_VideoData *vdata)
|
||||||
{
|
{
|
||||||
Wayland_CursorData *cdata = (Wayland_CursorData *) cursor->driverdata;
|
Wayland_CursorData *cdata = (Wayland_CursorData *) cursor->internal;
|
||||||
|
|
||||||
/* Probably not a cursor we own */
|
/* Probably not a cursor we own */
|
||||||
if (cdata == NULL) {
|
if (cdata == NULL) {
|
||||||
|
@ -830,7 +830,7 @@ void Wayland_RecreateCursors(void)
|
||||||
{
|
{
|
||||||
SDL_Cursor *cursor;
|
SDL_Cursor *cursor;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_VideoData *vdata = SDL_GetVideoDevice()->driverdata;
|
SDL_VideoData *vdata = SDL_GetVideoDevice()->internal;
|
||||||
|
|
||||||
if (vdata && vdata->cursor_themes) {
|
if (vdata && vdata->cursor_themes) {
|
||||||
SDL_free(vdata->cursor_themes);
|
SDL_free(vdata->cursor_themes);
|
||||||
|
@ -861,7 +861,7 @@ void Wayland_InitMouse(void)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *d = vd->driverdata;
|
SDL_VideoData *d = vd->internal;
|
||||||
struct SDL_WaylandInput *input = d->input;
|
struct SDL_WaylandInput *input = d->input;
|
||||||
|
|
||||||
mouse->CreateCursor = Wayland_CreateCursor;
|
mouse->CreateCursor = Wayland_CreateCursor;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
int Wayland_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
int Wayland_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
|
|
||||||
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)data->display, _this->gl_config.egl_platform);
|
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)data->display, _this->gl_config.egl_platform);
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ int Wayland_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||||
SDL_GLContext Wayland_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
SDL_GLContext Wayland_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_GLContext context;
|
SDL_GLContext context;
|
||||||
context = SDL_EGL_CreateContext(_this, window->driverdata->egl_surface);
|
context = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
|
||||||
WAYLAND_wl_display_flush(_this->driverdata->display);
|
WAYLAND_wl_display_flush(_this->internal->display);
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ int Wayland_GLES_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
|
||||||
|
|
||||||
int Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
int Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->internal;
|
||||||
const int swap_interval = _this->egl_data->egl_swapinterval;
|
const int swap_interval = _this->egl_data->egl_swapinterval;
|
||||||
|
|
||||||
/* For windows that we know are hidden, skip swaps entirely, if we don't do
|
/* For windows that we know are hidden, skip swaps entirely, if we don't do
|
||||||
|
@ -122,7 +122,7 @@ int Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
|
|
||||||
/* Control swap interval ourselves. See comments on Wayland_GLES_SetSwapInterval */
|
/* Control swap interval ourselves. See comments on Wayland_GLES_SetSwapInterval */
|
||||||
if (swap_interval != 0 && data->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) {
|
if (swap_interval != 0 && data->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) {
|
||||||
SDL_VideoData *videodata = _this->driverdata;
|
SDL_VideoData *videodata = _this->internal;
|
||||||
struct wl_display *display = videodata->display;
|
struct wl_display *display = videodata->display;
|
||||||
/* 20hz, so we'll progress even if throttled to zero. */
|
/* 20hz, so we'll progress even if throttled to zero. */
|
||||||
const Uint64 max_wait = SDL_GetTicksNS() + (SDL_NS_PER_SECOND / 20);
|
const Uint64 max_wait = SDL_GetTicksNS() + (SDL_NS_PER_SECOND / 20);
|
||||||
|
@ -176,12 +176,12 @@ int Wayland_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLC
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (window && context) {
|
if (window && context) {
|
||||||
ret = SDL_EGL_MakeCurrent(_this, window->driverdata->egl_surface, context);
|
ret = SDL_EGL_MakeCurrent(_this, window->internal->egl_surface, context);
|
||||||
} else {
|
} else {
|
||||||
ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
WAYLAND_wl_display_flush(_this->driverdata->display);
|
WAYLAND_wl_display_flush(_this->internal->display);
|
||||||
|
|
||||||
_this->egl_data->eglSwapInterval(_this->egl_data->egl_display, 0); /* see comments on Wayland_GLES_SetSwapInterval. */
|
_this->egl_data->eglSwapInterval(_this->egl_data->egl_display, 0); /* see comments on Wayland_GLES_SetSwapInterval. */
|
||||||
|
|
||||||
|
@ -191,13 +191,13 @@ int Wayland_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLC
|
||||||
int Wayland_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
int Wayland_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
SDL_EGL_DeleteContext(_this, context);
|
SDL_EGL_DeleteContext(_this, context);
|
||||||
WAYLAND_wl_display_flush(_this->driverdata->display);
|
WAYLAND_wl_display_flush(_this->internal->display);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLSurface Wayland_GLES_GetEGLSurface(SDL_VideoDevice *_this, SDL_Window *window)
|
EGLSurface Wayland_GLES_GetEGLSurface(SDL_VideoDevice *_this, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windowdata = window->driverdata;
|
SDL_WindowData *windowdata = window->internal;
|
||||||
|
|
||||||
return windowdata->egl_surface;
|
return windowdata->egl_surface;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ static struct wl_buffer_listener buffer_listener = {
|
||||||
int Wayland_AllocSHMBuffer(int width, int height, struct Wayland_SHMBuffer *shmBuffer)
|
int Wayland_AllocSHMBuffer(int width, int height, struct Wayland_SHMBuffer *shmBuffer)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
SDL_VideoDevice *vd = SDL_GetVideoDevice();
|
||||||
SDL_VideoData *data = vd->driverdata;
|
SDL_VideoData *data = vd->internal;
|
||||||
struct wl_shm_pool *shm_pool;
|
struct wl_shm_pool *shm_pool;
|
||||||
const Uint32 SHM_FMT = WL_SHM_FORMAT_ARGB8888;
|
const Uint32 SHM_FMT = WL_SHM_FORMAT_ARGB8888;
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ SDL_WindowData *Wayland_GetWindowDataForOwnedSurface(struct wl_surface *surface)
|
||||||
|
|
||||||
static void Wayland_DeleteDevice(SDL_VideoDevice *device)
|
static void Wayland_DeleteDevice(SDL_VideoDevice *device)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = device->driverdata;
|
SDL_VideoData *data = device->internal;
|
||||||
if (data->display && !data->display_externally_owned) {
|
if (data->display && !data->display_externally_owned) {
|
||||||
WAYLAND_wl_display_flush(data->display);
|
WAYLAND_wl_display_flush(data->display);
|
||||||
WAYLAND_wl_display_disconnect(data->display);
|
WAYLAND_wl_display_disconnect(data->display);
|
||||||
|
@ -445,7 +445,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
|
||||||
SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, display);
|
SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER, display);
|
||||||
}
|
}
|
||||||
|
|
||||||
device->driverdata = data;
|
device->internal = data;
|
||||||
device->wakeup_lock = SDL_CreateMutex();
|
device->wakeup_lock = SDL_CreateMutex();
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
|
@ -543,60 +543,60 @@ VideoBootStrap Wayland_bootstrap = {
|
||||||
static void xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output,
|
static void xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output,
|
||||||
int32_t x, int32_t y)
|
int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
driverdata->x = x;
|
internal->x = x;
|
||||||
driverdata->y = y;
|
internal->y = y;
|
||||||
driverdata->has_logical_position = SDL_TRUE;
|
internal->has_logical_position = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xdg_output,
|
static void xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xdg_output,
|
||||||
int32_t width, int32_t height)
|
int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
driverdata->screen_width = width;
|
internal->screen_width = width;
|
||||||
driverdata->screen_height = height;
|
internal->screen_height = height;
|
||||||
driverdata->has_logical_size = SDL_TRUE;
|
internal->has_logical_size = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output)
|
static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (void *)data;
|
SDL_DisplayData *internal = (void *)data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xdg-output.done events are deprecated and only apply below version 3 of the protocol.
|
* xdg-output.done events are deprecated and only apply below version 3 of the protocol.
|
||||||
* A wl-output.done event will be emitted in version 3 or higher.
|
* A wl-output.done event will be emitted in version 3 or higher.
|
||||||
*/
|
*/
|
||||||
if (zxdg_output_v1_get_version(driverdata->xdg_output) < 3) {
|
if (zxdg_output_v1_get_version(internal->xdg_output) < 3) {
|
||||||
display_handle_done(data, driverdata->output);
|
display_handle_done(data, internal->output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output,
|
static void xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
/* Deprecated as of wl_output v4. */
|
/* Deprecated as of wl_output v4. */
|
||||||
if (wl_output_get_version(driverdata->output) < WL_OUTPUT_NAME_SINCE_VERSION &&
|
if (wl_output_get_version(internal->output) < WL_OUTPUT_NAME_SINCE_VERSION &&
|
||||||
driverdata->display == 0) {
|
internal->display == 0) {
|
||||||
SDL_free(driverdata->wl_output_name);
|
SDL_free(internal->wl_output_name);
|
||||||
driverdata->wl_output_name = SDL_strdup(name);
|
internal->wl_output_name = SDL_strdup(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output,
|
static void xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output,
|
||||||
const char *description)
|
const char *description)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
/* Deprecated as of wl_output v4. */
|
/* Deprecated as of wl_output v4. */
|
||||||
if (wl_output_get_version(driverdata->output) < WL_OUTPUT_DESCRIPTION_SINCE_VERSION &&
|
if (wl_output_get_version(internal->output) < WL_OUTPUT_DESCRIPTION_SINCE_VERSION &&
|
||||||
driverdata->display == 0) {
|
internal->display == 0) {
|
||||||
/* xdg-output descriptions, if available, supersede wl-output model names. */
|
/* xdg-output descriptions, if available, supersede wl-output model names. */
|
||||||
SDL_free(driverdata->placeholder.name);
|
SDL_free(internal->placeholder.name);
|
||||||
driverdata->placeholder.name = SDL_strdup(description);
|
internal->placeholder.name = SDL_strdup(description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,27 +697,27 @@ static void display_handle_geometry(void *data,
|
||||||
int transform)
|
int transform)
|
||||||
|
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
/* Apply the change from wl-output only if xdg-output is not supported */
|
/* Apply the change from wl-output only if xdg-output is not supported */
|
||||||
if (!driverdata->has_logical_position) {
|
if (!internal->has_logical_position) {
|
||||||
driverdata->x = x;
|
internal->x = x;
|
||||||
driverdata->y = y;
|
internal->y = y;
|
||||||
}
|
}
|
||||||
driverdata->physical_width = physical_width;
|
internal->physical_width = physical_width;
|
||||||
driverdata->physical_height = physical_height;
|
internal->physical_height = physical_height;
|
||||||
|
|
||||||
/* The model is only used for the output name if wl_output or xdg-output haven't provided a description. */
|
/* The model is only used for the output name if wl_output or xdg-output haven't provided a description. */
|
||||||
if (driverdata->display == 0 && !driverdata->placeholder.name) {
|
if (internal->display == 0 && !internal->placeholder.name) {
|
||||||
driverdata->placeholder.name = SDL_strdup(model);
|
internal->placeholder.name = SDL_strdup(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
driverdata->transform = transform;
|
internal->transform = transform;
|
||||||
#define TF_CASE(in, out) \
|
#define TF_CASE(in, out) \
|
||||||
case WL_OUTPUT_TRANSFORM_##in: \
|
case WL_OUTPUT_TRANSFORM_##in: \
|
||||||
driverdata->orientation = SDL_ORIENTATION_##out; \
|
internal->orientation = SDL_ORIENTATION_##out; \
|
||||||
break;
|
break;
|
||||||
if (driverdata->physical_width >= driverdata->physical_height) {
|
if (internal->physical_width >= internal->physical_height) {
|
||||||
switch (transform) {
|
switch (transform) {
|
||||||
TF_CASE(NORMAL, LANDSCAPE)
|
TF_CASE(NORMAL, LANDSCAPE)
|
||||||
TF_CASE(90, PORTRAIT)
|
TF_CASE(90, PORTRAIT)
|
||||||
|
@ -750,22 +750,22 @@ static void display_handle_mode(void *data,
|
||||||
int height,
|
int height,
|
||||||
int refresh)
|
int refresh)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
||||||
driverdata->pixel_width = width;
|
internal->pixel_width = width;
|
||||||
driverdata->pixel_height = height;
|
internal->pixel_height = height;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't rotate this yet, wl-output coordinates are transformed in
|
* Don't rotate this yet, wl-output coordinates are transformed in
|
||||||
* handle_done and xdg-output coordinates are pre-transformed.
|
* handle_done and xdg-output coordinates are pre-transformed.
|
||||||
*/
|
*/
|
||||||
if (!driverdata->has_logical_size) {
|
if (!internal->has_logical_size) {
|
||||||
driverdata->screen_width = width;
|
internal->screen_width = width;
|
||||||
driverdata->screen_height = height;
|
internal->screen_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
driverdata->refresh = refresh;
|
internal->refresh = refresh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,8 +773,8 @@ static void display_handle_done(void *data,
|
||||||
struct wl_output *output)
|
struct wl_output *output)
|
||||||
{
|
{
|
||||||
const SDL_bool mode_emulation_enabled = SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION, SDL_TRUE);
|
const SDL_bool mode_emulation_enabled = SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION, SDL_TRUE);
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
SDL_VideoData *video = driverdata->videodata;
|
SDL_VideoData *video = internal->videodata;
|
||||||
SDL_DisplayMode native_mode, desktop_mode;
|
SDL_DisplayMode native_mode, desktop_mode;
|
||||||
SDL_VideoDisplay *dpy;
|
SDL_VideoDisplay *dpy;
|
||||||
|
|
||||||
|
@ -784,16 +784,16 @@ static void display_handle_done(void *data,
|
||||||
*
|
*
|
||||||
* All required events must be received before proceeding.
|
* All required events must be received before proceeding.
|
||||||
*/
|
*/
|
||||||
const int event_await_count = 1 + (driverdata->xdg_output != NULL);
|
const int event_await_count = 1 + (internal->xdg_output != NULL);
|
||||||
|
|
||||||
driverdata->wl_output_done_count = SDL_min(driverdata->wl_output_done_count + 1, event_await_count + 1);
|
internal->wl_output_done_count = SDL_min(internal->wl_output_done_count + 1, event_await_count + 1);
|
||||||
|
|
||||||
if (driverdata->wl_output_done_count < event_await_count) {
|
if (internal->wl_output_done_count < event_await_count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the display was already created, reset and rebuild the mode list. */
|
/* If the display was already created, reset and rebuild the mode list. */
|
||||||
dpy = SDL_GetVideoDisplay(driverdata->display);
|
dpy = SDL_GetVideoDisplay(internal->display);
|
||||||
if (dpy) {
|
if (dpy) {
|
||||||
SDL_ResetFullscreenDisplayModes(dpy);
|
SDL_ResetFullscreenDisplayModes(dpy);
|
||||||
}
|
}
|
||||||
|
@ -803,40 +803,40 @@ static void display_handle_done(void *data,
|
||||||
native_mode.format = SDL_PIXELFORMAT_XRGB8888;
|
native_mode.format = SDL_PIXELFORMAT_XRGB8888;
|
||||||
|
|
||||||
/* Transform the pixel values, if necessary. */
|
/* Transform the pixel values, if necessary. */
|
||||||
if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) {
|
if (internal->transform & WL_OUTPUT_TRANSFORM_90) {
|
||||||
native_mode.w = driverdata->pixel_height;
|
native_mode.w = internal->pixel_height;
|
||||||
native_mode.h = driverdata->pixel_width;
|
native_mode.h = internal->pixel_width;
|
||||||
} else {
|
} else {
|
||||||
native_mode.w = driverdata->pixel_width;
|
native_mode.w = internal->pixel_width;
|
||||||
native_mode.h = driverdata->pixel_height;
|
native_mode.h = internal->pixel_height;
|
||||||
}
|
}
|
||||||
native_mode.refresh_rate_numerator = driverdata->refresh;
|
native_mode.refresh_rate_numerator = internal->refresh;
|
||||||
native_mode.refresh_rate_denominator = 1000;
|
native_mode.refresh_rate_denominator = 1000;
|
||||||
|
|
||||||
if (driverdata->has_logical_size) { /* If xdg-output is present... */
|
if (internal->has_logical_size) { /* If xdg-output is present... */
|
||||||
if (native_mode.w != driverdata->screen_width || native_mode.h != driverdata->screen_height) {
|
if (native_mode.w != internal->screen_width || native_mode.h != internal->screen_height) {
|
||||||
/* ...and the compositor scales the logical viewport... */
|
/* ...and the compositor scales the logical viewport... */
|
||||||
if (video->viewporter) {
|
if (video->viewporter) {
|
||||||
/* ...and viewports are supported, calculate the true scale of the output. */
|
/* ...and viewports are supported, calculate the true scale of the output. */
|
||||||
driverdata->scale_factor = (float)native_mode.w / (float)driverdata->screen_width;
|
internal->scale_factor = (float)native_mode.w / (float)internal->screen_width;
|
||||||
} else {
|
} else {
|
||||||
/* ...otherwise, the 'native' pixel values are a multiple of the logical screen size. */
|
/* ...otherwise, the 'native' pixel values are a multiple of the logical screen size. */
|
||||||
driverdata->pixel_width = driverdata->screen_width * (int)driverdata->scale_factor;
|
internal->pixel_width = internal->screen_width * (int)internal->scale_factor;
|
||||||
driverdata->pixel_height = driverdata->screen_height * (int)driverdata->scale_factor;
|
internal->pixel_height = internal->screen_height * (int)internal->scale_factor;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* ...and the output viewport is not scaled in the global compositing
|
/* ...and the output viewport is not scaled in the global compositing
|
||||||
* space, the output dimensions need to be divided by the scale factor.
|
* space, the output dimensions need to be divided by the scale factor.
|
||||||
*/
|
*/
|
||||||
driverdata->screen_width /= (int)driverdata->scale_factor;
|
internal->screen_width /= (int)internal->scale_factor;
|
||||||
driverdata->screen_height /= (int)driverdata->scale_factor;
|
internal->screen_height /= (int)internal->scale_factor;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Calculate the points from the pixel values, if xdg-output isn't present.
|
/* Calculate the points from the pixel values, if xdg-output isn't present.
|
||||||
* Use the native mode pixel values since they are pre-transformed.
|
* Use the native mode pixel values since they are pre-transformed.
|
||||||
*/
|
*/
|
||||||
driverdata->screen_width = native_mode.w / (int)driverdata->scale_factor;
|
internal->screen_width = native_mode.w / (int)internal->scale_factor;
|
||||||
driverdata->screen_height = native_mode.h / (int)driverdata->scale_factor;
|
internal->screen_height = native_mode.h / (int)internal->scale_factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The scaled desktop mode */
|
/* The scaled desktop mode */
|
||||||
|
@ -844,33 +844,33 @@ static void display_handle_done(void *data,
|
||||||
desktop_mode.format = SDL_PIXELFORMAT_XRGB8888;
|
desktop_mode.format = SDL_PIXELFORMAT_XRGB8888;
|
||||||
|
|
||||||
if (!video->scale_to_display_enabled) {
|
if (!video->scale_to_display_enabled) {
|
||||||
desktop_mode.w = driverdata->screen_width;
|
desktop_mode.w = internal->screen_width;
|
||||||
desktop_mode.h = driverdata->screen_height;
|
desktop_mode.h = internal->screen_height;
|
||||||
desktop_mode.pixel_density = driverdata->scale_factor;
|
desktop_mode.pixel_density = internal->scale_factor;
|
||||||
} else {
|
} else {
|
||||||
desktop_mode.w = native_mode.w;
|
desktop_mode.w = native_mode.w;
|
||||||
desktop_mode.h = native_mode.h;
|
desktop_mode.h = native_mode.h;
|
||||||
desktop_mode.pixel_density = 1.0f;
|
desktop_mode.pixel_density = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
desktop_mode.refresh_rate_numerator = driverdata->refresh;
|
desktop_mode.refresh_rate_numerator = internal->refresh;
|
||||||
desktop_mode.refresh_rate_denominator = 1000;
|
desktop_mode.refresh_rate_denominator = 1000;
|
||||||
|
|
||||||
if (driverdata->display > 0) {
|
if (internal->display > 0) {
|
||||||
dpy = SDL_GetVideoDisplay(driverdata->display);
|
dpy = SDL_GetVideoDisplay(internal->display);
|
||||||
} else {
|
} else {
|
||||||
dpy = &driverdata->placeholder;
|
dpy = &internal->placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video->scale_to_display_enabled) {
|
if (video->scale_to_display_enabled) {
|
||||||
SDL_SetDisplayContentScale(dpy, driverdata->scale_factor);
|
SDL_SetDisplayContentScale(dpy, internal->scale_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the desktop display mode. */
|
/* Set the desktop display mode. */
|
||||||
SDL_SetDesktopDisplayMode(dpy, &desktop_mode);
|
SDL_SetDesktopDisplayMode(dpy, &desktop_mode);
|
||||||
|
|
||||||
/* Expose the unscaled, native resolution if the scale is 1.0 or viewports are available... */
|
/* Expose the unscaled, native resolution if the scale is 1.0 or viewports are available... */
|
||||||
if (driverdata->scale_factor == 1.0f || video->viewporter) {
|
if (internal->scale_factor == 1.0f || video->viewporter) {
|
||||||
SDL_AddFullscreenDisplayMode(dpy, &native_mode);
|
SDL_AddFullscreenDisplayMode(dpy, &native_mode);
|
||||||
} else {
|
} else {
|
||||||
/* ...otherwise expose the integer scaled variants of the desktop resolution down to 1. */
|
/* ...otherwise expose the integer scaled variants of the desktop resolution down to 1. */
|
||||||
|
@ -878,9 +878,9 @@ static void display_handle_done(void *data,
|
||||||
|
|
||||||
desktop_mode.pixel_density = 1.0f;
|
desktop_mode.pixel_density = 1.0f;
|
||||||
|
|
||||||
for (i = (int)driverdata->scale_factor; i > 0; --i) {
|
for (i = (int)internal->scale_factor; i > 0; --i) {
|
||||||
desktop_mode.w = driverdata->screen_width * i;
|
desktop_mode.w = internal->screen_width * i;
|
||||||
desktop_mode.h = driverdata->screen_height * i;
|
desktop_mode.h = internal->screen_height * i;
|
||||||
SDL_AddFullscreenDisplayMode(dpy, &desktop_mode);
|
SDL_AddFullscreenDisplayMode(dpy, &desktop_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -888,27 +888,27 @@ static void display_handle_done(void *data,
|
||||||
/* Add emulated modes if wp_viewporter is supported and mode emulation is enabled. */
|
/* Add emulated modes if wp_viewporter is supported and mode emulation is enabled. */
|
||||||
if (video->viewporter && mode_emulation_enabled) {
|
if (video->viewporter && mode_emulation_enabled) {
|
||||||
/* The transformed display pixel width/height must be used here. */
|
/* The transformed display pixel width/height must be used here. */
|
||||||
AddEmulatedModes(driverdata, native_mode.w, native_mode.h);
|
AddEmulatedModes(internal, native_mode.w, native_mode.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (driverdata->display == 0) {
|
if (internal->display == 0) {
|
||||||
/* First time getting display info, initialize the VideoDisplay */
|
/* First time getting display info, initialize the VideoDisplay */
|
||||||
if (driverdata->physical_width >= driverdata->physical_height) {
|
if (internal->physical_width >= internal->physical_height) {
|
||||||
driverdata->placeholder.natural_orientation = SDL_ORIENTATION_LANDSCAPE;
|
internal->placeholder.natural_orientation = SDL_ORIENTATION_LANDSCAPE;
|
||||||
} else {
|
} else {
|
||||||
driverdata->placeholder.natural_orientation = SDL_ORIENTATION_PORTRAIT;
|
internal->placeholder.natural_orientation = SDL_ORIENTATION_PORTRAIT;
|
||||||
}
|
}
|
||||||
driverdata->placeholder.current_orientation = driverdata->orientation;
|
internal->placeholder.current_orientation = internal->orientation;
|
||||||
driverdata->placeholder.driverdata = driverdata;
|
internal->placeholder.internal = internal;
|
||||||
|
|
||||||
/* During initialization, the displays will be added after enumeration is complete. */
|
/* During initialization, the displays will be added after enumeration is complete. */
|
||||||
if (!video->initializing) {
|
if (!video->initializing) {
|
||||||
driverdata->display = SDL_AddVideoDisplay(&driverdata->placeholder, SDL_TRUE);
|
internal->display = SDL_AddVideoDisplay(&internal->placeholder, SDL_TRUE);
|
||||||
SDL_free(driverdata->placeholder.name);
|
SDL_free(internal->placeholder.name);
|
||||||
SDL_zero(driverdata->placeholder);
|
SDL_zero(internal->placeholder);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SDL_SendDisplayEvent(dpy, SDL_EVENT_DISPLAY_ORIENTATION, driverdata->orientation, 0);
|
SDL_SendDisplayEvent(dpy, SDL_EVENT_DISPLAY_ORIENTATION, internal->orientation, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,26 +916,26 @@ static void display_handle_scale(void *data,
|
||||||
struct wl_output *output,
|
struct wl_output *output,
|
||||||
int32_t factor)
|
int32_t factor)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
driverdata->scale_factor = factor;
|
internal->scale_factor = factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_handle_name(void *data, struct wl_output *wl_output, const char *name)
|
static void display_handle_name(void *data, struct wl_output *wl_output, const char *name)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
SDL_free(driverdata->wl_output_name);
|
SDL_free(internal->wl_output_name);
|
||||||
driverdata->wl_output_name = SDL_strdup(name);
|
internal->wl_output_name = SDL_strdup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_handle_description(void *data, struct wl_output *wl_output, const char *description)
|
static void display_handle_description(void *data, struct wl_output *wl_output, const char *description)
|
||||||
{
|
{
|
||||||
SDL_DisplayData *driverdata = (SDL_DisplayData *)data;
|
SDL_DisplayData *internal = (SDL_DisplayData *)data;
|
||||||
|
|
||||||
if (driverdata->display == 0) {
|
if (internal->display == 0) {
|
||||||
/* The description, if available, supersedes the model name. */
|
/* The description, if available, supersedes the model name. */
|
||||||
SDL_free(driverdata->placeholder.name);
|
SDL_free(internal->placeholder.name);
|
||||||
driverdata->placeholder.name = SDL_strdup(description);
|
internal->placeholder.name = SDL_strdup(description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,13 +979,13 @@ static int Wayland_add_display(SDL_VideoData *d, uint32_t id, uint32_t version)
|
||||||
static void Wayland_free_display(SDL_VideoDisplay *display)
|
static void Wayland_free_display(SDL_VideoDisplay *display)
|
||||||
{
|
{
|
||||||
if (display) {
|
if (display) {
|
||||||
SDL_DisplayData *display_data = display->driverdata;
|
SDL_DisplayData *display_data = display->internal;
|
||||||
|
|
||||||
/* A preceding surface leave event is not guaranteed when an output is removed,
|
/* A preceding surface leave event is not guaranteed when an output is removed,
|
||||||
* so ensure that no window continues to hold a reference to a removed output.
|
* so ensure that no window continues to hold a reference to a removed output.
|
||||||
*/
|
*/
|
||||||
for (SDL_Window *window = SDL_GetVideoDevice()->windows; window; window = window->next) {
|
for (SDL_Window *window = SDL_GetVideoDevice()->windows; window; window = window->next) {
|
||||||
Wayland_RemoveOutputFromWindow(window->driverdata, display_data);
|
Wayland_RemoveOutputFromWindow(window->internal, display_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(display_data->wl_output_name);
|
SDL_free(display_data->wl_output_name);
|
||||||
|
@ -1187,7 +1187,7 @@ SDL_bool Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg)
|
||||||
|
|
||||||
int Wayland_VideoInit(SDL_VideoDevice *_this)
|
int Wayland_VideoInit(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
|
|
||||||
data->xkb_context = WAYLAND_xkb_context_new(0);
|
data->xkb_context = WAYLAND_xkb_context_new(0);
|
||||||
if (!data->xkb_context) {
|
if (!data->xkb_context) {
|
||||||
|
@ -1237,15 +1237,15 @@ int Wayland_VideoInit(SDL_VideoDevice *_this)
|
||||||
|
|
||||||
static int Wayland_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
static int Wayland_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
|
||||||
{
|
{
|
||||||
SDL_VideoData *viddata = _this->driverdata;
|
SDL_VideoData *viddata = _this->internal;
|
||||||
SDL_DisplayData *driverdata = display->driverdata;
|
SDL_DisplayData *internal = display->internal;
|
||||||
rect->x = driverdata->x;
|
rect->x = internal->x;
|
||||||
rect->y = driverdata->y;
|
rect->y = internal->y;
|
||||||
|
|
||||||
/* When an emulated, exclusive fullscreen window has focus, treat the mode dimensions as the display bounds. */
|
/* When an emulated, exclusive fullscreen window has focus, treat the mode dimensions as the display bounds. */
|
||||||
if (display->fullscreen_window &&
|
if (display->fullscreen_window &&
|
||||||
display->fullscreen_window->fullscreen_exclusive &&
|
display->fullscreen_window->fullscreen_exclusive &&
|
||||||
display->fullscreen_window->driverdata->active &&
|
display->fullscreen_window->internal->active &&
|
||||||
display->fullscreen_window->current_fullscreen_mode.w != 0 &&
|
display->fullscreen_window->current_fullscreen_mode.w != 0 &&
|
||||||
display->fullscreen_window->current_fullscreen_mode.h != 0) {
|
display->fullscreen_window->current_fullscreen_mode.h != 0) {
|
||||||
rect->w = display->fullscreen_window->current_fullscreen_mode.w;
|
rect->w = display->fullscreen_window->current_fullscreen_mode.w;
|
||||||
|
@ -1254,12 +1254,12 @@ static int Wayland_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *di
|
||||||
if (!viddata->scale_to_display_enabled) {
|
if (!viddata->scale_to_display_enabled) {
|
||||||
rect->w = display->current_mode->w;
|
rect->w = display->current_mode->w;
|
||||||
rect->h = display->current_mode->h;
|
rect->h = display->current_mode->h;
|
||||||
} else if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) {
|
} else if (internal->transform & WL_OUTPUT_TRANSFORM_90) {
|
||||||
rect->w = driverdata->pixel_height;
|
rect->w = internal->pixel_height;
|
||||||
rect->h = driverdata->pixel_width;
|
rect->h = internal->pixel_width;
|
||||||
} else {
|
} else {
|
||||||
rect->w = driverdata->pixel_width;
|
rect->w = internal->pixel_width;
|
||||||
rect->h = driverdata->pixel_height;
|
rect->h = internal->pixel_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1267,7 +1267,7 @@ static int Wayland_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *di
|
||||||
|
|
||||||
static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
|
static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Wayland_FiniMouse(data);
|
Wayland_FiniMouse(data);
|
||||||
|
@ -1411,7 +1411,7 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this)
|
||||||
SDL_bool Wayland_VideoReconnect(SDL_VideoDevice *_this)
|
SDL_bool Wayland_VideoReconnect(SDL_VideoDevice *_this)
|
||||||
{
|
{
|
||||||
#if 0 /* TODO RECONNECT: Uncomment all when https://invent.kde.org/plasma/kwin/-/wikis/Restarting is completed */
|
#if 0 /* TODO RECONNECT: Uncomment all when https://invent.kde.org/plasma/kwin/-/wikis/Restarting is completed */
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
|
|
||||||
SDL_Window *window = NULL;
|
SDL_Window *window = NULL;
|
||||||
|
|
||||||
|
@ -1460,7 +1460,7 @@ void Wayland_VideoQuit(SDL_VideoDevice *_this)
|
||||||
Wayland_VideoCleanup(_this);
|
Wayland_VideoCleanup(_this);
|
||||||
|
|
||||||
#ifdef HAVE_LIBDECOR_H
|
#ifdef HAVE_LIBDECOR_H
|
||||||
SDL_VideoData *data = _this->driverdata;
|
SDL_VideoData *data = _this->internal;
|
||||||
if (data->shell.libdecor) {
|
if (data->shell.libdecor) {
|
||||||
libdecor_unref(data->shell.libdecor);
|
libdecor_unref(data->shell.libdecor);
|
||||||
data->shell.libdecor = NULL;
|
data->shell.libdecor = NULL;
|
||||||
|
|
|
@ -134,7 +134,7 @@ int Wayland_Vulkan_CreateSurface(SDL_VideoDevice *_this,
|
||||||
const struct VkAllocationCallbacks *allocator,
|
const struct VkAllocationCallbacks *allocator,
|
||||||
VkSurfaceKHR *surface)
|
VkSurfaceKHR *surface)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windowData = window->driverdata;
|
SDL_WindowData *windowData = window->internal;
|
||||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
|
||||||
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
|
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
|
||||||
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
|
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
|
||||||
|
@ -200,7 +200,7 @@ SDL_bool Wayland_Vulkan_GetPresentationSupport(SDL_VideoDevice *_this,
|
||||||
|
|
||||||
return vkGetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice,
|
return vkGetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice,
|
||||||
queueFamilyIndex,
|
queueFamilyIndex,
|
||||||
_this->driverdata->display);
|
_this->internal->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue