Fix invalidation of bound textures/shaders across a renderer flush on D3D9 #14940
+10
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The following sequence of renderer commands is currently broken on D3D9:
The problem is that when
SDL_FlushRenderer()callsD3D_InvalidateCachedState(), the renderer forgets that it still has the YUV shader and U/V planes bound.SetDrawState()then thinks it only needs to update texture 0 before rendering. The result is that the area where the RGB texture is supposed to go is instead drawn with the YUV shader with RGB texture as the Y plane and the U/V planes from the last YUV texture.This PR fixes the issue by adding a new
texture_state_dirtymember which forcesSetDrawState()to update the bound textures and shader. It also fixes the case where an app might have bound their own textures or shader afterSDL_FlushRenderer()and not unbound them before calling into SDL again.Existing Issue(s)