GLES3: always make gl calls when setting filter and repeat on texture#79367
Closed
LRFLEW wants to merge 1 commit into
Closed
GLES3: always make gl calls when setting filter and repeat on texture#79367LRFLEW wants to merge 1 commit into
LRFLEW wants to merge 1 commit into
Conversation
AThousandShips
requested changes
Jul 12, 2023
Member
|
Thanks for taking a stab at this! While this PR appears to be a helpful workaround for #79315, it is not a solution that we can consider merging into the engine. Instead, of removing the caching system entirely, the proper fix will be to fix the case that is triggering a false positive in the caching system |
This was referenced Jul 17, 2023
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is intended as a fix for #79315. Sometimes the repeat property of a texture doesn't get updated, usually when the texture has been seen recently. While looking through the source code, I noticed that it avoids calling
glTexParameteriif it thinks it's redundant, and figured this is likely a culprit. Changing this so it always updates the texture parameters resolves the issue from my testing. While I was at it, I also made the change for updating the filtering mode (including anisotropic filtering), since it uses the same caching system, and could have similar issues with it. This isn't an elegant solution, as it doesn't directly address the original cause of the stale state, but it's a viable one.As to why the bug exists in the first place, I'm assuming it's down to something related to the re-use of data and/or IDs in
TextureStorage. How exactly it happens, I didn't test. One option is that the values forstate_filterandstate_repeatare leftovers from an unrelated texture, so the engine thinks it's already set the parameters for the current texture when it hasn't. (If this is the case, then the bug should also apply to the filtering mode, though I didn't really test that). Another option is that some of the texture parameters are reset when certain actions are performed on an existing texture (such as changing the pixel data).This PR should be safe to cherry-pick for a 4.1.x release. I will also understand if you'd rather take a different approach to resolving this issue, since this is a bit of a blunt solution.