WolfireGames / overgrowth

Open Source codebase of the game Overgrowth by Wolfire Games LLC
Apache License 2.0
2.51k stars 260 forks source link

Fix a really bad hack in Shaders::createProgram #24

Open turol opened 2 years ago

turol commented 2 years ago

https://github.com/WolfireGames/overgrowth/blob/08da859107194d3d283c6b54565bffb656478a26/Source/Graphics/shaders.cpp#L708

IIRC this was for geometry shaders which were sometimes required and sometimes not. However this depended on the shader preprocessor flags so the hack we came up with was to #error in the shader code and then just ignore any errors in geometry shaders. This should be re-thought. Are geometry shaders even used anymore? It's discouraged nowadays and several platforms don't support them, Vulkan makes it an optional feature and Metal doesn't support it at all.

shinymerlyn commented 2 years ago

I think geometry shaders were an experiment to try to "upres" some geometry. Not sure they actually made it into the mainstream experience. And yeah, I've read that avoiding geometry shaders is preferrable.

turol commented 2 years ago

I think it was used for rendering multiple shadow map faces (cube or cascade) with one draw call. Less CPU load, more GPU load.

autious commented 2 years ago

One general use case was generating a camera-facing quad from a point, used for things like particles or other billboards. But yes, now it's considered obsolete.