Improve screen-space shaders, some minor clean-up#1593
Merged
VReaperV merged 10 commits intoDaemonEngine:masterfrom Mar 17, 2025
Merged
Improve screen-space shaders, some minor clean-up#1593VReaperV merged 10 commits intoDaemonEngine:masterfrom
VReaperV merged 10 commits intoDaemonEngine:masterfrom
Conversation
Member
|
Wow, all those copy-pasted shaders looked like cargo cult. Thank you very much for deduplicating that! |
386e4c8 to
461af9a
Compare
Contributor
Author
Yeah, it's been on my mind for some time now, especially as I keep needing to either re-build existing shaders with different graphics settings, or create new ones. |
Contributor
Author
|
I've also added a couple more commits with some clean-up. |
6a89a29 to
e14fc72
Compare
7714ca5 to
5c823f8
Compare
Member
|
GLSL doesn't build |
5c823f8 to
e0f0efc
Compare
Contributor
Author
Should be fixed now. |
e0f0efc to
10fc03d
Compare
Member
|
I'm getting crashes when enabling bloom. |
Contributor
Author
Fixed now. |
Changes `GLShader` constructors, removing unnecessary stuff from them, and making it only have 2 distinct constructors - for rendering shaders and compute shaders. Changes the relevant shaders to use a new `screenSpace` shader, which is almost a no-op. NUKE the the other .glsl shaders that just repeat the same functionality. Also NUKES the `u_ModelViewProjectionMatrix` from them, because the result is always a full-screen quad anyway. Adds `Tess_InstantScreenSpaceQuad()` for use with this, because with some other shaders we still do need `u_ModelViewProjectionMatrix`.
Also NUKE `u_ModelViewProjectionMatrix` and `u_TextureMatrix`, because they have no effect there.
Fix screen-space shaders. Use a triangle IBO with vertexes being set directly in the vertex shader based on `gl_VertexID`. Re-order the shader stuff that was becoming a bit of a mess.
f0bf2a3 to
a67058e
Compare
Contributor
Author
|
Removed |
Member
|
I got this with the |
Contributor
Author
Fixed. |
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.
Requires #1586
Changes
GLShaderconstructors, removing unnecessary stuff from them, and making it only have 2 distinct constructors - for rendering shaders and compute shaders.Changes the relevant shaders to use a new
screenSpaceshader, which is almost a no-op.NUKE the the other .glsl shaders that just repeat the same functionality.
Also NUKES the
u_ModelViewProjectionMatrixfrom them, because the result is always a full-screen quad anyway.Adds
Tess_InstantScreenSpaceQuad()for use with this, because with some other shaders we still do needu_ModelViewProjectionMatrix. This actually draws a single triangle that gets clipped to the screen (this has a good explanation why).The screen-space shaders in this pr are ones that always process the whole screen, and where the vertex shaders were the same anyway, while sending the
u_ModelViewProjectionMatrixuniform and multiplying the vertex position with it, and, indeed, even having a VBO for them at all, was useless.I didn't touch the
screenshader here, although it really is just another screen-space shader. It is, however, also used forST_SCREENMAPstage, which I don't think we use anywhere, and seems to be intended for use on something like an in-game camera screen. That wouldn't work properly though, due to how the texture coordinates are calculated (relative to the screen position of the fragment, not the world/model position). We could probably just use thegenericshader for that.Also cleaned-up the formatting and ordering of shaders/shader files.
This brings down the total amount of shader compilation, shader program linking (with #1587), and shader files.