Skip to content
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

implement pre-collapsed shader stage, fix #216 #230

Merged
merged 4 commits into from Dec 12, 2019

Conversation

illwieckz
Copy link
Member

@illwieckz illwieckz commented Dec 7, 2019

This is my attempt to implement pre-collapsed shader stages, as defined in #216.
This will allow to use more than one collapsed (multi-texture) stage per shader.

Historical syntax (Doom3-like) with collapsing heuristic is still there.

@illwieckz illwieckz force-pushed the pre-collapsed-shader branch 5 times, most recently from 282a4ac to 587d295 Compare December 7, 2019 14:12
@illwieckz illwieckz changed the title WIP: implement pre-collapsed shader stage, fix #216 implement pre-collapsed shader stage, fix #216 Dec 7, 2019
@illwieckz
Copy link
Member Author

illwieckz commented Dec 7, 2019

That looks ready to me

@illwieckz
Copy link
Member Author

I removed the colorMap stage keyword as it is useless and seems to have no reason to be used. In the engine, a colormap is a simple map without anything else (no lightmap, no normal…).

@illwieckz
Copy link
Member Author

I merged into master the very first commit that is not doing anything on the code itself, except moving some text to make subsequent PR less noisy.

@illwieckz illwieckz force-pushed the pre-collapsed-shader branch 4 times, most recently from f5559c5 to b3f6d4f Compare December 9, 2019 01:11
@illwieckz illwieckz force-pushed the pre-collapsed-shader branch 3 times, most recently from 54d86b0 to df516c0 Compare December 9, 2019 06:45
@illwieckz
Copy link
Member Author

illwieckz commented Dec 9, 2019

Note to myself; I said there: #189 (comment)

that I had an implementation to collapse both lighting stages and reflection stages with an unified glsl shader (I hope I still have the branch somewhere 😁 ) but this is blocked because of #190.

Once a fix is found for #190, many lines would be deletable.

src/engine/renderer/tr_shader.cpp Show resolved Hide resolved
src/engine/renderer/tr_shader.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_shader.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_shader.cpp Outdated Show resolved Hide resolved
src/engine/renderer/tr_shader.cpp Show resolved Hide resolved
@illwieckz
Copy link
Member Author

@slipher: resolved remarks, rebased on master

collapseTextureEnv is not used at all

colorMap stage is by definition a map that is not collapsed
so this keyword is absolutely useless
@slipher
Copy link
Member

slipher commented Dec 12, 2019

Code seems all right to me. I don't understand anything about shaders, of course.

@illwieckz
Copy link
Member Author

illwieckz commented Dec 12, 2019

I don't understand anything about shaders, of course.

Which is unfotunately to expect: that code is probably the most obscure part of dæmon, at least the most obscure I've seen.

Basically XreaL project hacked shader parser of Quake 3 to parse Doom3 shaders the quick and dirty way, expecting multi textures as shader globals (what does Doom 3) while the Quake 3 design allows advanced stage blending and operation. While those textures parts (normal/spec/glow) can perfectly run as separate stages, for performance reason it's better to collapse everything we can to render as must things we can in one pass, hence the convoluted collapse code that has to deal with the fact there is way to define textures both in shader stages and shader globals… 😨

To add features it's usually required to redesign from scratch some parts that do not make possible to extend the existing code to add such features. So, hopefully, PR after PR the code becomes less complex. And less buggy: there is a lot of dragons ready to bite in dark corners, and bugs, those dragons are trained and bugs squished as I walk over the code. It's all about serendipity.

@illwieckz illwieckz merged commit 5cda362 into DaemonEngine:master Dec 12, 2019
@illwieckz illwieckz added T-Improvement Improvement for an existing feature A-Renderer labels Dec 13, 2019
@illwieckz illwieckz deleted the pre-collapsed-shader branch December 31, 2019 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Improvement Improvement for an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants