mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-29 10:01:35 +00:00
Added constant definitions for SDL properties
Fixes https://github.com/libsdl-org/SDL/issues/8622
This commit is contained in:
@@ -805,9 +805,9 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind
|
||||
SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
|
||||
{
|
||||
#ifndef SDL_RENDER_DISABLED
|
||||
SDL_Window *window = SDL_GetProperty(props, "window", NULL);
|
||||
SDL_Surface *surface = SDL_GetProperty(props, "surface", NULL);
|
||||
const char *name = SDL_GetStringProperty(props, "name", NULL);
|
||||
SDL_Window *window = SDL_GetProperty(props, SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER, NULL);
|
||||
SDL_Surface *surface = SDL_GetProperty(props, SDL_PROPERTY_RENDERER_CREATE_SURFACE_POINTER, NULL);
|
||||
const char *name = SDL_GetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, NULL);
|
||||
SDL_Renderer *renderer = NULL;
|
||||
const int n = SDL_GetNumRenderDrivers();
|
||||
const char *hint;
|
||||
@@ -838,7 +838,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
|
||||
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC);
|
||||
if (hint && *hint) {
|
||||
SDL_SetBooleanProperty(props, "present_vsync", SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE));
|
||||
SDL_SetBooleanProperty(props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_GetHintBoolean(SDL_HINT_RENDER_VSYNC, SDL_TRUE));
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
@@ -871,7 +871,7 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (SDL_GetBooleanProperty(props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
renderer->wanted_vsync = SDL_TRUE;
|
||||
|
||||
if (!(renderer->info.flags & SDL_RENDERER_PRESENTVSYNC)) {
|
||||
@@ -947,14 +947,14 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
SDL_SetProperty(props, "window", window);
|
||||
SDL_SetProperty(props, SDL_PROPERTY_RENDERER_CREATE_WINDOW_POINTER, window);
|
||||
if (flags & SDL_RENDERER_SOFTWARE) {
|
||||
SDL_SetStringProperty(props, "name", "software");
|
||||
SDL_SetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, "software");
|
||||
} else {
|
||||
SDL_SetStringProperty(props, "name", name);
|
||||
SDL_SetStringProperty(props, SDL_PROPERTY_RENDERER_CREATE_NAME_STRING, name);
|
||||
}
|
||||
if (flags & SDL_RENDERER_PRESENTVSYNC) {
|
||||
SDL_SetBooleanProperty(props, "present_vsync", SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_TRUE);
|
||||
}
|
||||
renderer = SDL_CreateRendererWithProperties(props);
|
||||
SDL_DestroyProperties(props);
|
||||
@@ -1124,10 +1124,10 @@ static SDL_ScaleMode SDL_GetScaleMode(void)
|
||||
SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Texture *texture;
|
||||
Uint32 format = (Uint32)SDL_GetNumberProperty(props, "format", SDL_PIXELFORMAT_UNKNOWN);
|
||||
int access = (int)SDL_GetNumberProperty(props, "access", SDL_TEXTUREACCESS_STATIC);
|
||||
int w = (int)SDL_GetNumberProperty(props, "width", 0);
|
||||
int h = (int)SDL_GetNumberProperty(props, "height", 0);
|
||||
Uint32 format = (Uint32)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER, SDL_PIXELFORMAT_UNKNOWN);
|
||||
int access = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER, SDL_TEXTUREACCESS_STATIC);
|
||||
int w = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER, 0);
|
||||
int h = (int)SDL_GetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER, 0);
|
||||
SDL_bool texture_is_fourcc_and_target;
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, NULL);
|
||||
@@ -1244,10 +1244,10 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access
|
||||
{
|
||||
SDL_Texture *texture;
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
SDL_SetNumberProperty(props, "format", format);
|
||||
SDL_SetNumberProperty(props, "access", access);
|
||||
SDL_SetNumberProperty(props, "width", w);
|
||||
SDL_SetNumberProperty(props, "height", h);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_FORMAT_NUMBER, format);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_ACCESS_NUMBER, access);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_WIDTH_NUMBER, w);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_CREATE_HEIGHT_NUMBER, h);
|
||||
texture = SDL_CreateTextureWithProperties(renderer, props);
|
||||
SDL_DestroyProperties(props);
|
||||
return texture;
|
||||
|
||||
@@ -1610,7 +1610,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
||||
}
|
||||
|
||||
SDL_zero(pparams);
|
||||
pparams.hDeviceWindow = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd", NULL);
|
||||
pparams.hDeviceWindow = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
pparams.BackBufferWidth = w;
|
||||
pparams.BackBufferHeight = h;
|
||||
pparams.BackBufferCount = 1;
|
||||
@@ -1625,7 +1625,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
||||
pparams.BackBufferFormat = D3DFMT_UNKNOWN;
|
||||
pparams.FullScreen_RefreshRateInHz = 0;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
pparams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
} else {
|
||||
pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
@@ -1709,7 +1709,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_SetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d9.device", data->device);
|
||||
SDL_SetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D9_DEVICE_POINTER, data->device);
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
@@ -665,7 +665,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
ID3D11DeviceContext_VSSetShader(data->d3dContext, data->vertexShader, NULL, 0);
|
||||
ID3D11DeviceContext_VSSetConstantBuffers(data->d3dContext, 0, 1, &data->vertexShaderConstants);
|
||||
|
||||
SDL_SetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d11.device", data->d3dDevice);
|
||||
SDL_SetProperty(SDL_GetRendererProperties(renderer), SDL_PROPERTY_RENDERER_D3D11_DEVICE_POINTER, data->d3dDevice);
|
||||
|
||||
done:
|
||||
SAFE_RELEASE(d3dDevice);
|
||||
@@ -829,7 +829,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||
#endif
|
||||
} else {
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd", NULL);
|
||||
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
|
||||
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
|
||||
(IUnknown *)data->d3dDevice,
|
||||
@@ -1137,7 +1137,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
|
||||
}
|
||||
}
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d11.texture", textureData->mainTexture);
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_POINTER, textureData->mainTexture);
|
||||
#if SDL_HAVE_YUV
|
||||
if (texture->format == SDL_PIXELFORMAT_YV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_IYUV) {
|
||||
@@ -1159,7 +1159,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
|
||||
}
|
||||
}
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d11.texture_u", textureData->mainTextureU);
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_U_POINTER, textureData->mainTextureU);
|
||||
|
||||
if (GetTextureProperty(create_props, "d3d11.texture_v", &textureData->mainTextureV) < 0) {
|
||||
return -1;
|
||||
@@ -1174,7 +1174,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
|
||||
}
|
||||
}
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d11.texture_v", textureData->mainTextureV);
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D11_TEXTURE_V_POINTER, textureData->mainTextureV);
|
||||
}
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_NV21) {
|
||||
@@ -2488,7 +2488,7 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
|
||||
*/
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
#else
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
renderer->SetVSync = D3D11_SetVSync;
|
||||
|
||||
@@ -44,7 +44,7 @@ using namespace Windows::Graphics::Display;
|
||||
extern "C" void *
|
||||
D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer)
|
||||
{
|
||||
IInspectable *window = (IInspectable *)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.winrt.window", NULL);
|
||||
IInspectable *window = (IInspectable *)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WINRT_WINDOW_POINTER, NULL);
|
||||
ABI::Windows::UI::Core::ICoreWindow *coreWindow = NULL;
|
||||
if (!window || FAILED(window->QueryInterface(&coreWindow))) {
|
||||
return NULL;
|
||||
|
||||
@@ -324,8 +324,8 @@ static void D3D12_ReleaseAll(SDL_Renderer *renderer)
|
||||
SDL_Texture *texture = NULL;
|
||||
|
||||
SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
|
||||
SDL_SetProperty(props, "SDL.renderer.d3d12.device", NULL);
|
||||
SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", NULL);
|
||||
SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER, NULL);
|
||||
SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER, NULL);
|
||||
|
||||
/* Release all textures */
|
||||
for (texture = renderer->textures; texture; texture = texture->next) {
|
||||
@@ -1074,8 +1074,8 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
data->srvPoolHead = &data->srvPoolNodes[0];
|
||||
|
||||
SDL_PropertiesID props = SDL_GetRendererProperties(renderer);
|
||||
SDL_SetProperty(props, "SDL.renderer.d3d12.device", data->d3dDevice);
|
||||
SDL_SetProperty(props, "SDL.renderer.d3d12.command_queue", data->commandQueue);
|
||||
SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_DEVICE_POINTER, data->d3dDevice);
|
||||
SDL_SetProperty(props, SDL_PROPERTY_RENDERER_D3D12_COMMAND_QUEUE_POINTER, data->commandQueue);
|
||||
|
||||
done:
|
||||
SAFE_RELEASE(d3dDevice);
|
||||
@@ -1179,7 +1179,7 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | /* To support SetMaximumFrameLatency */
|
||||
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; /* To support presenting with allow tearing on */
|
||||
|
||||
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd", NULL);
|
||||
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), SDL_PROPERTY_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
|
||||
result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd,
|
||||
(IUnknown *)data->commandQueue,
|
||||
@@ -1506,7 +1506,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
}
|
||||
}
|
||||
textureData->mainResourceState = D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d12.texture", textureData->mainTexture);
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_POINTER, textureData->mainTexture);
|
||||
#if SDL_HAVE_YUV
|
||||
if (texture->format == SDL_PIXELFORMAT_YV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_IYUV) {
|
||||
@@ -1533,7 +1533,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
}
|
||||
}
|
||||
textureData->mainResourceStateU = D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d12.texture_u", textureData->mainTextureU);
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_U_POINTER, textureData->mainTextureU);
|
||||
|
||||
if (GetTextureProperty(create_props, "d3d12.texture_v", &textureData->mainTextureV) < 0) {
|
||||
return -1;
|
||||
@@ -1553,7 +1553,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
}
|
||||
}
|
||||
textureData->mainResourceStateV = D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), "SDL.texture.d3d12.texture_v", textureData->mainTextureV);
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_D3D12_TEXTURE_V_POINTER, textureData->mainTextureV);
|
||||
}
|
||||
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
@@ -3027,7 +3027,7 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
|
||||
renderer->driverdata = data;
|
||||
D3D12_InvalidateCachedState(renderer);
|
||||
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
renderer->SetVSync = D3D12_SetVSync;
|
||||
|
||||
@@ -1630,8 +1630,8 @@ static int METAL_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||
static SDL_MetalView GetWindowView(SDL_Window *window)
|
||||
{
|
||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
||||
NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window", NULL);
|
||||
NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.metal_view_tag", 0);
|
||||
NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_WINDOW_POINTER, NULL);
|
||||
NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER, 0);
|
||||
if (nswindow && tag) {
|
||||
NSView *view = nswindow.contentView;
|
||||
if (view.subviews.count > 0) {
|
||||
@@ -1644,8 +1644,8 @@ static SDL_MetalView GetWindowView(SDL_Window *window)
|
||||
#endif
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_UIKIT
|
||||
UIWindow *uiwindow = (__bridge UIWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.window", NULL);
|
||||
NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.metal_view_tag", 0);
|
||||
UIWindow *uiwindow = (__bridge UIWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_UIKIT_WINDOW_POINTER, NULL);
|
||||
NSInteger tag = (NSInteger)SDL_GetNumberProperty(SDL_GetWindowProperties(window), SDL_PROPERTY_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER, 0);
|
||||
if (uiwindow && tag) {
|
||||
UIView *view = uiwindow.rootViewController.view;
|
||||
if (view.tag == tag) {
|
||||
@@ -1924,7 +1924,7 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
|
||||
|
||||
#if (defined(__MACOS__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
|
||||
if (@available(macOS 10.13, *)) {
|
||||
data.mtllayer.displaySyncEnabled = SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE);
|
||||
data.mtllayer.displaySyncEnabled = SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE);
|
||||
if (data.mtllayer.displaySyncEnabled) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
data->fbo = NULL;
|
||||
}
|
||||
|
||||
data->texture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture", 0);
|
||||
data->texture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER, 0);
|
||||
if (data->texture) {
|
||||
data->texture_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -531,9 +531,9 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
data->texh = (GLfloat)texture->h / texture_h;
|
||||
}
|
||||
SDL_PropertiesID props = SDL_GetTextureProperties(texture);
|
||||
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture", data->texture);
|
||||
SDL_SetFloatProperty(props, "SDL.texture.opengl.tex_w", data->texw);
|
||||
SDL_SetFloatProperty(props, "SDL.texture.opengl.tex_h", data->texh);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_NUMBER, data->texture);
|
||||
SDL_SetFloatProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEX_W_FLOAT, data->texw);
|
||||
SDL_SetFloatProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEX_H_FLOAT, data->texh);
|
||||
|
||||
data->format = format;
|
||||
data->formattype = type;
|
||||
@@ -592,13 +592,13 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
texture->format == SDL_PIXELFORMAT_IYUV) {
|
||||
data->yuv = SDL_TRUE;
|
||||
|
||||
data->utexture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture_u", 0);
|
||||
data->utexture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER, 0);
|
||||
if (data->utexture) {
|
||||
data->utexture_external = SDL_TRUE;
|
||||
} else {
|
||||
renderdata->glGenTextures(1, &data->utexture);
|
||||
}
|
||||
data->vtexture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture_v", 0);
|
||||
data->vtexture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER, 0);
|
||||
if (data->vtexture) {
|
||||
data->vtexture_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -616,7 +616,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
GL_CLAMP_TO_EDGE);
|
||||
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
|
||||
(texture_h + 1) / 2, 0, format, type, NULL);
|
||||
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture_u", data->utexture);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_U_NUMBER, data->utexture);
|
||||
|
||||
renderdata->glBindTexture(textype, data->vtexture);
|
||||
renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER,
|
||||
@@ -629,14 +629,14 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
GL_CLAMP_TO_EDGE);
|
||||
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
|
||||
(texture_h + 1) / 2, 0, format, type, NULL);
|
||||
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture_v", data->vtexture);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_V_NUMBER, data->vtexture);
|
||||
}
|
||||
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_NV21) {
|
||||
data->nv12 = SDL_TRUE;
|
||||
|
||||
data->utexture = (GLuint)SDL_GetNumberProperty(create_props, "opengl.texture_uv", 0);
|
||||
data->utexture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER, 0);
|
||||
if (data->utexture) {
|
||||
data->utexture_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -653,7 +653,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Pr
|
||||
GL_CLAMP_TO_EDGE);
|
||||
renderdata->glTexImage2D(textype, 0, GL_LUMINANCE_ALPHA, (texture_w + 1) / 2,
|
||||
(texture_h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL);
|
||||
SDL_SetNumberProperty(props, "SDL.texture.opengl.texture_uv", data->utexture);
|
||||
SDL_SetNumberProperty(props, SDL_PROPERTY_TEXTURE_OPENGL_TEXTURE_UV_NUMBER, data->utexture);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1867,7 +1867,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
|
||||
*/
|
||||
#endif
|
||||
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
} else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
|
||||
@@ -1508,7 +1508,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
|
||||
#if SDL_HAVE_YUV
|
||||
if (data->yuv) {
|
||||
data->texture_v = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture_v", 0);
|
||||
data->texture_v = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER, 0);
|
||||
if (data->texture_v) {
|
||||
data->texture_v_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -1524,9 +1524,9 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL);
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture_v", data->texture_v);
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER, data->texture_v);
|
||||
|
||||
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture_u", 0);
|
||||
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER, 0);
|
||||
if (data->texture_u) {
|
||||
data->texture_u_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -1545,10 +1545,10 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
if (GL_CheckError("glTexImage2D()", renderer) < 0) {
|
||||
return -1;
|
||||
}
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture_u", data->texture_u);
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER, data->texture_u);
|
||||
|
||||
} else if (data->nv12) {
|
||||
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture_uv", 0);
|
||||
data->texture_u = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER, 0);
|
||||
if (data->texture_u) {
|
||||
data->texture_u_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -1567,11 +1567,11 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
if (GL_CheckError("glTexImage2D()", renderer) < 0) {
|
||||
return -1;
|
||||
}
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture_uv", data->texture_u);
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER, data->texture_u);
|
||||
}
|
||||
#endif
|
||||
|
||||
data->texture = (GLuint)SDL_GetNumberProperty(create_props, "opengles2.texture", 0);
|
||||
data->texture = (GLuint)SDL_GetNumberProperty(create_props, SDL_PROPERTY_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER, 0);
|
||||
if (data->texture) {
|
||||
data->texture_external = SDL_TRUE;
|
||||
} else {
|
||||
@@ -1593,7 +1593,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), "SDL.texture.opengles2.texture", data->texture);
|
||||
SDL_SetNumberProperty(SDL_GetTextureProperties(texture), SDL_PROPERTY_TEXTURE_OPENGLES2_TEXTURE_NUMBER, data->texture);
|
||||
|
||||
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
||||
data->fbo = GLES2_GetFBO(renderer->driverdata, texture->w, texture->h);
|
||||
@@ -2155,10 +2155,10 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
|
||||
* is turned on. Not doing so will freeze the screen's contents to that
|
||||
* of the first drawn frame.
|
||||
*/
|
||||
SDL_SetBooleanProperty(create_props, "present_vsync", SDL_TRUE);
|
||||
SDL_SetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_TRUE);
|
||||
#endif
|
||||
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
} else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
|
||||
@@ -643,7 +643,7 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, SDL_PropertiesID cre
|
||||
|
||||
data->gsGlobal = gsGlobal;
|
||||
dynamicVsync = SDL_GetHintBoolean(SDL_HINT_PS2_DYNAMIC_VSYNC, SDL_FALSE);
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
data->vsync = (dynamicVsync ? 2 : 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1345,7 +1345,7 @@ SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
||||
data->most_recent_target = NULL;
|
||||
data->least_recent_target = NULL;
|
||||
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
data->vsync = SDL_TRUE;
|
||||
} else {
|
||||
data->vsync = SDL_FALSE;
|
||||
|
||||
@@ -1168,7 +1168,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
|
||||
}
|
||||
|
||||
if (no_hint_set) {
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1");
|
||||
} else {
|
||||
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "0");
|
||||
|
||||
@@ -260,7 +260,7 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, SDL_PropertiesID creat
|
||||
|
||||
data->initialized = SDL_TRUE;
|
||||
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROPERTY_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
data->displayData.wait_vblank = SDL_TRUE;
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user