D3D11: Fix SDL_TEXTUREACCESS_TARGET not working if SDL_HAVE_YUV was 0

Added a couple of missing SDL_zeros in CreateTexture
main
chalonverse 2022-06-08 12:38:43 -07:00 committed by Sam Lantinga
parent 8303c5d0a3
commit 6f69bbc541
1 changed files with 4 additions and 1 deletions

View File

@ -1177,6 +1177,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} }
} }
#endif /* SDL_HAVE_YUV */ #endif /* SDL_HAVE_YUV */
SDL_zero(resourceViewDesc);
resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.Format = textureDesc.Format;
resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
resourceViewDesc.Texture2D.MostDetailedMip = 0; resourceViewDesc.Texture2D.MostDetailedMip = 0;
@ -1227,9 +1228,11 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
} }
} }
#endif /* SDL_HAVE_YUV */
if (texture->access & SDL_TEXTUREACCESS_TARGET) { if (texture->access & SDL_TEXTUREACCESS_TARGET) {
D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
SDL_zero(renderTargetViewDesc);
renderTargetViewDesc.Format = textureDesc.Format; renderTargetViewDesc.Format = textureDesc.Format;
renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
renderTargetViewDesc.Texture2D.MipSlice = 0; renderTargetViewDesc.Texture2D.MipSlice = 0;
@ -1243,7 +1246,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result);
} }
} }
#endif /* SDL_HAVE_YUV */
return 0; return 0;
} }