You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on some discussion in #11970:
Some of our shader code can be difficult to read due to deeply nested compiler directives. The readability problem is exacerbated by inconsistent indentation. For example, in MaterialStageFS, we had:
One popular style guide recommends that all preprocessor directives start at the beginning of the line, and that the directives should not affect the indentation of the rest of the code. This would be a significant change to all our shaders.
Another strategy is to reduce the level of nesting by pulling some of the #define logic out into a subroutine. The above sample then becomes:
Based on some discussion in #11970:
Some of our shader code can be difficult to read due to deeply nested compiler directives. The readability problem is exacerbated by inconsistent indentation. For example, in MaterialStageFS, we had:
One popular style guide recommends that all preprocessor directives start at the beginning of the line, and that the directives should not affect the indentation of the rest of the code. This would be a significant change to all our shaders.
Another strategy is to reduce the level of nesting by pulling some of the
#define
logic out into a subroutine. The above sample then becomes:Reduced nesting would be readability improvement, even independent of the choice we make for indentation.
Options for the CodingGuide could be:
The text was updated successfully, but these errors were encountered: