mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-27 19:19:41 +08:00
Make sure the render target isn't bound as a resource
Fixes https://github.com/libsdl-org/SDL/issues/3380
(cherry picked from commit a73132177d)
This commit is contained in:
@@ -1842,6 +1842,19 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
|||||||
ID3D11BlendState *blendState = NULL;
|
ID3D11BlendState *blendState = NULL;
|
||||||
SDL_bool updateSubresource = SDL_FALSE;
|
SDL_bool updateSubresource = SDL_FALSE;
|
||||||
|
|
||||||
|
if (numShaderResources > 0) {
|
||||||
|
shaderResource = shaderResources[0];
|
||||||
|
} else {
|
||||||
|
shaderResource = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure the render target isn't bound to a shader */
|
||||||
|
if (shaderResource != rendererData->currentShaderResource) {
|
||||||
|
ID3D11ShaderResourceView *pNullResource = NULL;
|
||||||
|
ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, 1, &pNullResource);
|
||||||
|
rendererData->currentShaderResource = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (renderTargetView != rendererData->currentRenderTargetView) {
|
if (renderTargetView != rendererData->currentRenderTargetView) {
|
||||||
ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext,
|
ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext,
|
||||||
1,
|
1,
|
||||||
@@ -1905,11 +1918,6 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
|||||||
ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, shader, NULL, 0);
|
ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, shader, NULL, 0);
|
||||||
rendererData->currentShader = shader;
|
rendererData->currentShader = shader;
|
||||||
}
|
}
|
||||||
if (numShaderResources > 0) {
|
|
||||||
shaderResource = shaderResources[0];
|
|
||||||
} else {
|
|
||||||
shaderResource = NULL;
|
|
||||||
}
|
|
||||||
if (shaderResource != rendererData->currentShaderResource) {
|
if (shaderResource != rendererData->currentShaderResource) {
|
||||||
ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, numShaderResources, shaderResources);
|
ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, numShaderResources, shaderResources);
|
||||||
rendererData->currentShaderResource = shaderResource;
|
rendererData->currentShaderResource = shaderResource;
|
||||||
|
|||||||
Reference in New Issue
Block a user