mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 18:37:40 +00:00
Removed SDL_RendererFlags
The flags parameter has been removed from SDL_CreateRenderer() and SDL_RENDERER_PRESENTVSYNC has been replaced with SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER during window creation and SDL_PROP_RENDERER_VSYNC_NUMBER after renderer creation. SDL_SetRenderVSync() now takes additional values besides 0 and 1. The maximum texture size has been removed from SDL_RendererInfo, replaced with SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER.
This commit is contained in:
parent
678cfd23c0
commit
17520c2e6e
41 changed files with 265 additions and 394 deletions
|
@ -1552,13 +1552,38 @@ static int D3D_Reset(SDL_Renderer *renderer)
|
|||
static int D3D_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||
{
|
||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
||||
if (vsync) {
|
||||
data->pparams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
} else {
|
||||
data->pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
DWORD PresentationInterval;
|
||||
switch (vsync) {
|
||||
case 0:
|
||||
PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
break;
|
||||
case 1:
|
||||
PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
break;
|
||||
case 2:
|
||||
PresentationInterval = D3DPRESENT_INTERVAL_TWO;
|
||||
break;
|
||||
case 3:
|
||||
PresentationInterval = D3DPRESENT_INTERVAL_THREE;
|
||||
break;
|
||||
case 4:
|
||||
PresentationInterval = D3DPRESENT_INTERVAL_FOUR;
|
||||
break;
|
||||
default:
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
D3DCAPS9 caps;
|
||||
HRESULT result = IDirect3D9_GetDeviceCaps(data->d3d, data->adapter, D3DDEVTYPE_HAL, &caps);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("GetDeviceCaps()", result);
|
||||
}
|
||||
if (!(caps.PresentationIntervals & PresentationInterval)) {
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
data->pparams.PresentationInterval = PresentationInterval;
|
||||
|
||||
if (D3D_Reset(renderer) < 0) {
|
||||
/* D3D_Reset will call SDL_SetError() */
|
||||
return -1;
|
||||
|
@ -1644,17 +1669,17 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie
|
|||
pparams.BackBufferFormat = D3DFMT_UNKNOWN;
|
||||
pparams.FullScreen_RefreshRateInHz = 0;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(create_props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN, SDL_FALSE)) {
|
||||
pparams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
} else {
|
||||
pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
}
|
||||
pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
|
||||
/* Get the adapter for the display that the window is on */
|
||||
displayID = SDL_GetDisplayForWindow(window);
|
||||
data->adapter = SDL_Direct3D9GetAdapterIndex(displayID);
|
||||
|
||||
IDirect3D9_GetDeviceCaps(data->d3d, data->adapter, D3DDEVTYPE_HAL, &caps);
|
||||
result = IDirect3D9_GetDeviceCaps(data->d3d, data->adapter, D3DDEVTYPE_HAL, &caps);
|
||||
if (FAILED(result)) {
|
||||
D3D_DestroyRenderer(renderer);
|
||||
return D3D_SetError("GetDeviceCaps()", result);
|
||||
}
|
||||
|
||||
device_flags = D3DCREATE_FPU_PRESERVE;
|
||||
if (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
|
||||
|
@ -1690,14 +1715,10 @@ int D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_Propertie
|
|||
return D3D_SetError("GetPresentParameters()", result);
|
||||
}
|
||||
IDirect3DSwapChain9_Release(chain);
|
||||
if (pparams.PresentationInterval == D3DPRESENT_INTERVAL_ONE) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
data->pparams = pparams;
|
||||
|
||||
IDirect3DDevice9_GetDeviceCaps(data->device, &caps);
|
||||
renderer->info.max_texture_width = caps.MaxTextureWidth;
|
||||
renderer->info.max_texture_height = caps.MaxTextureHeight;
|
||||
SDL_SetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, SDL_min(caps.MaxTextureWidth, caps.MaxTextureHeight));
|
||||
|
||||
if (caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND) {
|
||||
data->enableSeparateAlphaBlend = SDL_TRUE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue