GLES3: Don't call glTexParameter* for invalid filter and repeat modes#79685
Merged
Conversation
clayjohn
approved these changes
Jul 20, 2023
clayjohn
left a comment
Member
There was a problem hiding this comment.
Looks great! _DEFAULT should definitely be handled like _MAX neither is technically a valid input to this function, but _MAX is handy to invalidate the cache. In either case avoid gl calls makes sense.
Contributor
Author
|
I rebased off the current master branch to resolve the merge conflict |
glTexParameter* for invalid filter and repeat modes
Contributor
|
Thanks! |
Contributor
|
Cherry-picked for 4.1.2. |
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 fixes #79315. That issue was caused by
TextureStorage::_clear_render_targetcallingTexture::gl_set_filterandTexture::gl_set_repeatwith the value*_MAX. Thegl_set_filterandgl_set_repeatfunctions weren't designed to be called with the values (which appear to be used to force the next calls to makeglTexParameter*calls), which results in whatever happens to be the currently bound OpenGL texture to be assigned unexpected parameters. This PR updatesTexture::gl_set_filterandTexture::gl_set_repeatso that they only make calls toglTexParameter*whenp_filter/p_repeatis a valid value.I also made some small changes to these functions that shouldn't affect functionality, but figured would be nice to cleanup while I'm here. I removed the (IMO) unhelpful comments and updated how
max_lodis assigned to be more consistent with the other local variables ingl_set_filter. I also changed the default values ofTexture::state_filterandTexture::state_repeatto better represent their uninitialized state. This shouldn't have an effect on the engine, as these values get initialized inTextureStorage::_texture_set_dataeither way.The only part of this I'm not sure about is the handling of
*_DEFAULTas the argument. From what I can tell, they should never be used with these functions, so I didn't add a specific case for them, and chose to handle them the same a*_MAX(or any invalid enum value). If this needs to be changed, let me know what behavior you would want these to have, and I can update this PR.This PR targets the master branch, but it should be safe to cherry-pick for a 4.1.X release. This PR may interact with #79568 and may require a rebase if that gets merged first.