-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
renderer: split generic and generic3D #1436
base: master
Are you sure you want to change the base?
Conversation
This is to be merged after: As this assumes this other branch is already merged (hence the |
The only usage of
They all live in The |
Also, there may be no need for any Only |
Should never need to exist. We could get most of the benefit of boilerplate reduction by switching off GLSL macros en masse rather than one at a time, replacing
with
|
Yes but there is still a one-line boilerplate to be copy-pasted every time And a type can do it better. |
I believe lighting here is the more important distinction (height maps, normal maps etc. also have to do with lighting). |
Yeah, I don't see the point in that either, UI wouldn't benefit from it, and generating materials for UI wuld require rewriting a lot of code. |
That part was just my memory being wrong. That doesn't change the fact there may be no need for a material variant of such stripped down generic shader, unlike the generic3D one, which is what I wanted to say. |
b5fb9c9
to
dbe52d3
Compare
I wonder if such simple shader would be reusable for displaying a startup logo as soon as possible: It would then be the very first shader being compiled, maybe not having permutations and being simple may help for having it built as soon as possible? |
This will no longer be the case after #1439 is merged, so it can then be merged with the 3D shader. The |
Since it turned out that 2D drawing doesn't actually need any special GLSL, I might make a very basic shader to be shared by 2D and debug drawing. But as a different GLSL source file please, not more macros on |
The new |
This shader would have less than 10 lines in its |
Does 2D transformation require some vertex complex code? |
Nope, it's just |
Nice! |
Split
gl_genericShader
andgl_generic3DShader
.Here are the current usages:
gl_genericShader
: Mostly used by debug tools and things only requiring a very simple shader.gl_generic2DShader
: Used for 2D UI elements, it has special code for RmlUi transforms.gl_generic3DShader
: Full-featured shader for stages with a single texture.gl_lightMapping
: Full-featured shader for multi-textured stages.The
generic2D
andgeneric3D
names are temporary names, we can rename them later to something more meaningful, as 2D and 3D can be confusing with 2D and 3D textures but they both receive 2D textures, we may rename them likegenericUI
andgeneric<SOMETHING>
. TheRender_generic2D
,Render_generic3D
and theRender_generic
wrapper (that only calls code usinggl_generic2DShader
andgl_generic3DShader
) may be renamed too in the future.If it happens that by doing so when compiling
gl_genericShader
we recompile a shader that already exists as a permutation ofgl_generic3DShader
, we may improve caching to deduplicate them (this may even deduplicate somegl_generic2DShader
too):This split has nothing to do with light overbright, I first implemented it as part of my overbright efforts because such overbright effort was one of the use case where such changes having already be made before would have make things easier. The overbright effort just reminded me I wanted to do that for a long time, so I decided it was the right time to finally do it.