Repository navigation
Keep the sprite shader text identical to TurboWarp - #7
Merged
Merged
Conversation
Extensions such as Looks Expanded patch the sprite shaders with find-and-replace on exact lines. Batching pen triangles added a triangle draw mode to sprite.vert and sprite.frag and changed the vertex guard those patches match, so the patched line shader referenced a_texCoord and u_projectionMatrix without declaring them. Every pen line then failed to compile, logging the error again on each draw. Pen triangles now use their own small shader, built outside _buildShader and the sprite shader cache, so extension patches and cache clears leave it alone. The sprite shaders are back to TurboWarp's text, and a test checks the lines extensions rely on.
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.
Projects using unsandboxed extensions that patch the renderer's shaders with find-and-replace, such as SharkPool's Looks Expanded, flood the console with
Failed to compile shader (mode line, effects 0): 'a_texCoord' : undeclared identifier. Their pen lines never draw, and the shader recompiles and fails again on every draw.The cause is #5 (batch pen triangles). It added a
triangledraw mode tosprite.vertandsprite.fragand changed the vertex guard to#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background) || defined(DRAW_MODE_triangle)). Looks Expanded replaces the TurboWarp version of that exact line with#if 1so its injected code can usea_texCoordand the matrices in every mode. With the new text the replace no longer matches, so the patched line and triangle shaders fail to compile.Changes
sprite.vertandsprite.fragare back to TurboWarp's text, byte for byte.triangle.vert/triangle.fragpair fromShaderManager.getTriangleShader(). That method is built outside_buildShaderand the_shaderCache, so extensions that rewrite sprite shaders, or delete every cached program, leave it alone.DRAW_MODE.triangleis removed. Nothing outsidePenSkinused it._compileProgram, which both paths share.test/unit/ShaderSourceTests.jschecks that the sprite shaders still contain the lines extensions patch, and that the triangle mode has not crept back into them.Testing
npm run lint,npm run buildandnpx tap test/unitpass locally.This change has nothing visible in the UI, so the PR has no screenshots. The symptom was console errors and missing pen lines.