Skip to content
Permalink
Browse files
Fixed bug 4582 - Maximize/Resize not working on Windows 10
When viewport is set, projectionAndView changes, but ID3D11DeviceContext_UpdateSubresource was not called.
  • Loading branch information
1bsyl committed Apr 8, 2019
1 parent eb7affe commit d68e501db4bdf4dcdc06456572ab70f44f43125e
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/render/direct3d11/SDL_render_d3d11.c
@@ -1897,7 +1897,7 @@ D3D11_UpdateViewport(SDL_Renderer * renderer)
* with a non-empty viewport.
*/
/* SDL_Log("%s, no viewport was set!\n", __FUNCTION__); */
return 0;
return -1;
}

/* Make sure the SDL viewport gets rotated to that of the physical display's rotation.
@@ -1997,6 +1997,7 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11
ID3D11ShaderResourceView *shaderResource;
const SDL_BlendMode blendMode = cmd->data.draw.blend;
ID3D11BlendState *blendState = NULL;
SDL_bool updateSubresource = SDL_FALSE;

if (renderTargetView != rendererData->currentRenderTargetView) {
ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext,
@@ -2008,7 +2009,10 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11
}

if (rendererData->viewportDirty) {
D3D11_UpdateViewport(renderer);
if (D3D11_UpdateViewport(renderer) == 0) {
/* vertexShaderConstantsData.projectionAndView has changed */
updateSubresource = SDL_TRUE;
}
}

if (rendererData->cliprectDirty) {
@@ -2073,7 +2077,7 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11
rendererData->currentSampler = sampler;
}

if (SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)) != 0) {
if (updateSubresource == SDL_TRUE || SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)) != 0) {
SDL_memcpy(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix));
ID3D11DeviceContext_UpdateSubresource(rendererData->d3dContext,
(ID3D11Resource *)rendererData->vertexShaderConstants,

0 comments on commit d68e501

Please sign in to comment.