mirror of https://github.com/libsdl-org/SDL
SDL_render: Call InvalidateCachedState to initialise some of driverdata values (eg '*_dirty' to 1).
At the earliest place, immediatly after driverdata is set. (Doing it in SDL_render.c, after creation, would be too late, because there're renderers that already use/change those values in the CreateRender() function).
This commit is contained in:
parent
058213366b
commit
7c71e72193
|
@ -1511,12 +1511,9 @@ static int D3D_Reset(SDL_Renderer *renderer)
|
|||
IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
|
||||
D3D_InitRenderState(data);
|
||||
D3D_SetRenderTargetInternal(renderer, renderer->target);
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
||||
data->drawstate.texture = NULL;
|
||||
data->drawstate.shader = NULL;
|
||||
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
||||
|
||||
D3D_InvalidateCachedState(renderer);
|
||||
|
||||
IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX *)&d3dmatrix);
|
||||
|
||||
/* Let the application know that render targets were reset */
|
||||
|
@ -1605,6 +1602,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
|||
renderer->info = D3D_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
D3D_InvalidateCachedState(renderer);
|
||||
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
|
||||
|
@ -1710,10 +1708,6 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
|||
}
|
||||
}
|
||||
#endif
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
||||
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
||||
|
||||
SDL_SetProperty(SDL_GetRendererProperties(renderer), "SDL.renderer.d3d9.device", data->device);
|
||||
|
||||
|
|
|
@ -2472,6 +2472,7 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
|
|||
renderer->info = D3D11_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
D3D11_InvalidateCachedState(renderer);
|
||||
|
||||
#if SDL_WINAPI_FAMILY_PHONE
|
||||
/* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1.
|
||||
|
|
|
@ -480,6 +480,7 @@ static void D3D12_ResetCommandList(D3D12_RenderData *data)
|
|||
data->cliprectDirty = SDL_TRUE;
|
||||
data->viewportDirty = SDL_TRUE;
|
||||
data->currentRenderTargetView.ptr = 0;
|
||||
/* FIXME should we also clear currentSampler.ptr and currentRenderTargetView.ptr ? (and use D3D12_InvalidateCachedState() instead) */
|
||||
|
||||
/* Release any upload buffers that were inflight */
|
||||
for (i = 0; i < data->currentUploadBuffer; ++i) {
|
||||
|
@ -3023,6 +3024,7 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
|
|||
renderer->info = D3D12_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
D3D12_InvalidateCachedState(renderer);
|
||||
|
||||
if (SDL_GetBooleanProperty(create_props, "present_vsync", SDL_FALSE)) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
|
|
|
@ -1796,6 +1796,7 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
|
|||
}
|
||||
|
||||
renderer->driverdata = (void *)CFBridgingRetain(data);
|
||||
METAL_InvalidateCachedState(renderer);
|
||||
renderer->window = window;
|
||||
|
||||
data.mtlview = view;
|
||||
|
|
|
@ -1832,6 +1832,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
|
|||
renderer->info = GL_RenderDriver.info;
|
||||
renderer->info.flags = 0; /* will set some flags below. */
|
||||
renderer->driverdata = data;
|
||||
GL_InvalidateCachedState(renderer);
|
||||
renderer->window = window;
|
||||
|
||||
data->context = SDL_GL_CreateContext(window);
|
||||
|
@ -2008,8 +2009,6 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
|
|||
/* This ended up causing video discrepancies between OpenGL and Direct3D */
|
||||
/* data->glEnable(GL_LINE_SMOOTH); */
|
||||
|
||||
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
||||
data->drawstate.shader = SHADER_INVALID;
|
||||
data->drawstate.color = 0xFFFFFFFF;
|
||||
data->drawstate.clear_color = 0xFFFFFFFF;
|
||||
|
||||
|
|
|
@ -2119,6 +2119,7 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
|
|||
renderer->info = GLES2_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
GLES2_InvalidateCachedState(renderer);
|
||||
renderer->window = window;
|
||||
|
||||
/* Create an OpenGL ES 2.0 context */
|
||||
|
@ -2255,7 +2256,6 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
|
|||
|
||||
data->glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
||||
data->drawstate.clear_color = 0xFFFFFFFF;
|
||||
data->drawstate.projection[3][0] = -1.0f;
|
||||
data->drawstate.projection[3][3] = 1.0f;
|
||||
|
|
|
@ -669,6 +669,7 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, SDL_PropertiesID cre
|
|||
renderer->info = PS2_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
PS2_InvalidateCachedState(renderer);
|
||||
renderer->window = window;
|
||||
|
||||
if (data->vsync) {
|
||||
|
|
|
@ -1338,6 +1338,7 @@ SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_pro
|
|||
renderer->info = PSP_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
PSP_InvalidateCachedState(renderer);
|
||||
renderer->window = window;
|
||||
|
||||
data->initialized = SDL_TRUE;
|
||||
|
|
|
@ -1146,6 +1146,7 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
|
|||
renderer->DestroyRenderer = SW_DestroyRenderer;
|
||||
renderer->info = SW_RenderDriver.info;
|
||||
renderer->driverdata = data;
|
||||
SW_InvalidateCachedState(renderer);
|
||||
|
||||
SW_SelectBestFormats(renderer, surface->format->format);
|
||||
|
||||
|
|
|
@ -255,6 +255,7 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, SDL_PropertiesID creat
|
|||
renderer->info = VITA_GXM_RenderDriver.info;
|
||||
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
||||
renderer->driverdata = data;
|
||||
VITA_GXM_InvalidateCachedState(renderer);
|
||||
renderer->window = window;
|
||||
|
||||
data->initialized = SDL_TRUE;
|
||||
|
|
Loading…
Reference in New Issue