Repository navigation
Fall back to a 10-bit motion vector u/v map if half floats can't be rendered to - #1081
Open
Coastrnaut wants to merge 1 commit into
Open
Coastrnaut wants to merge 1 commit into
Coastrnaut wants to merge 1 commit into
Conversation
…endered to The warp pass writes the texture coordinates for the motion vectors into a GL_RG16F texture attached to the preset framebuffer. OpenGL ES 3.0 and 3.1 can only render to half-float textures with EXT_color_buffer_float or EXT_color_buffer_half_float; without them the framebuffer is incomplete while the warp mesh is drawn. Now that OpenGL ES 3.0 contexts are accepted, use GL_RGB10_A2 for the map in that case. It stores the coordinates with 10 bits each, about one pixel at 1024 pixels width. Desktop GL and OpenGL ES 3.2 are unchanged.
This branch has not been deployed
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.
Related to #998 and #1004
Since e98fca8, projectM accepts OpenGL ES 3.0 contexts, e.g. ANGLE on Direct3D 11 as in #998. One part of the renderer still needs more than core ES 3.0: the warp pass writes the texture coordinates used for the motion vectors into a
GL_RG16Ftexture attached to the preset framebuffer. Half-float textures are only color-renderable in OpenGL ES 3.2, or in 3.0 and 3.1 withEXT_color_buffer_floatorEXT_color_buffer_half_float. Without them, the framebuffer is incomplete while the warp mesh is drawn, so nothing is rendered.Change
MilkdropPresetchecks whether half floats can be rendered to: always in desktop GL and ES 3.2, otherwise if one of the two extensions is listed. If they can't, the u/v map usesGL_RGB10_A2, which every ES 3.0 implementation can render to. The map only holds texture coordinates in 0..1, so 10 bits give the motion vector start points about one pixel of precision at 1024 pixels width.Desktop GL and OpenGL ES 3.2 use
GL_RG16Fas before.Of the other ES 3.1/3.2 features listed in #998, I found no use of vertex attribute binding (
glVertexAttribBinding/glBindVertexBuffer) in the current code. Array-of-arrays in preset shaders still needs GLSL ES 3.10, which affects only the presets that use it.Testing
Windows, RTX A6000. The NVIDIA driver always creates an OpenGL ES 3.2 context, so I tested the fallback with a local build that always takes it.
GL_RG16F, their final frames differ by a mean of about 2/255 per channel; 1.5 to 2.1% of the channels differ by more than 16, where vector endpoints moved by a pixel.GL_RG16F: over the first 400 presets of the packs in the ES context, 66 render different frames, all with the same compile/link results and failed loads and 0 GL errors. Since each preset continues from the image the previous one left, a difference carries over to the following presets.I couldn't test on an actual ES 3.0 implementation without the extensions, such as ANGLE's D3D11 backend.
It merges cleanly with my other open PRs and with all other open PRs.