Exempt user bitmaps from texture detail culling#7617
Open
Goober5000 wants to merge 2 commits into
Open
Conversation
At texture detail below maximum, opengl_create_texture() culls texture dimensions on upload, but user bitmaps are streaming surfaces (streamed animations, video) whose frames are updated through gr_update_texture() with the bitmap's own dimensions. Once culled, the glTexSubImage3D update exceeds the texture's actual size, so OpenGL rejects it with GL_INVALID_VALUE and the animation silently freezes on its first, downsampled frame. Culling them also saves nothing, since full-size frame data is streamed every frame regardless. Also assert in gr_opengl_update_texture() that the update dimensions match the texture, so any future mismatch of this kind is caught in debug builds instead of failing silently. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gr_opengl_tcache_set() leaves the previous binding active when it fails, so the glTexParameteri calls that follow would modify the filter state of an unrelated texture. Only set the parameter when the volume texture actually bound. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
At texture detail below maximum, opengl_create_texture() culls texture
dimensions on upload, but user bitmaps are streaming surfaces
(streamed animations, video) whose frames are updated through
gr_update_texture() with the bitmap's own dimensions. Once culled, the
glTexSubImage3D update exceeds the texture's actual size, so OpenGL
rejects it with GL_INVALID_VALUE and the animation silently freezes on
its first, downsampled frame. Culling them also saves nothing, since
full-size frame data is streamed every frame regardless.
Also assert in gr_opengl_update_texture() that the update dimensions
match the texture, so any future mismatch of this kind is caught in
debug builds instead of failing silently.
And add a check for texture bind results in gr_opengl_tcache_set().