renderer: catch shader source processing exceptions and print raw source#1614
Open
renderer: catch shader source processing exceptions and print raw source#1614
Conversation
This was a cheat cvar used for dynamic lights that have no intensity set, and set to 2.0 for absolutely no reason whatsoever.
…ET() to RE_AddDynamicLightToScene() These were largely doing the same thing, use just one function instead.
This has largely the same functionality as trap_R_AddLightToScene().
This was only used to scale the light's colour, just multiply the colour with it earlier on instead.
This was already removed from the ABI so it was just unused.
Redesign the scheme for storing light grid direction and directedness vs. ambientness information in the pixels of a 3D image. Note for context: the light grid does not store the separate directed and ambient colors; it just averages them. Before: Light dir is always stored as a normal vector. There is an "ambient part" byte which is supposed to indicate what fraction of the light is ambient and what fraction directed. After: Light dir is scaled according to how much ambient light there is. Amount of light which is ambient is determined by how long the direction vector is. Some issues with the old code which are fixed: - Wrong averaging of the directed and ambient colors. Previously directed and ambient colors were equally weighted, but ambient should have more weight since there is no dot product term which can decrease it. - Bad interpolation behavior. Example 1: if neighboring grid cells had nearly opposing directions, the resulting direction vector would be garbage. With the new code, this results in a small vector which causes most light to be automatically moved into directed instead of ambient. Example 2: if one cell has a large directed component and its neighbor has none, the directions are equally weighted despite the second one being meaningless. With the new code, directions are weighted according to how much directed light there is. - Excessive brightness when deluxe mapping is disabled, because it behaved in that case as if the normal vector were always perfectly aligned with the light direction.
The previous commit fixed excessive brightness with grid lighting when deluxe mapping is disabled by using the average expected brightness (over all directions) instead of the maximum, but it went too far and made things dim. Boost the light a bit since light directions are positively correlated with normals in practice.
Using git bisect, e497a08 introduces a window where globalUBOProxy can be null after glsl_restart. Therefore, also return early, if glboalUBOProxy is null. It will be instantiated later. Further, only initialize world shaders *AFTER* all shader storage has been initialized.
09775ad to
2bf3f00
Compare
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.
Catch shader source processing exceptions and print raw source if something bad happened while processing the source.
See #1612:
Unhandled exception (St12length_error): basic_string::_M_replace_auxerror #1612This doesn't fix the underlying cause of the processing error, but at least the engine doesn't crash, the source get printed, the error message get printed, and it is possible to debug the GLSL shader code in some kind of degraded mode.