Page MenuHomeWildfire Games

Update GLSL preprocessor.
ClosedPublic

Authored by Stan on Dec 7 2019, 4:03 PM.

Details

Reviewers
vladislavbelov
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23404: Upgrade the Ogre GLSL Preprocessor
Summary

The current version of our preprocessor is severly outdated, and it would be nice to use the latest version provided with ogre.
This one comes with a few fixes, as well as support for elifs statements.

To update the preprocessor I did the following.

  1. Copied the file from here:
  2. Remove the missing includes
    • #include "OgrePlatform.h"
    • #include "OgreLogManager.h"
  3. Replace the logger by the snprintf function
  4. Revert the change
  5. Replace Assert calls by ENSURE
    • Remove #include <assert.h>
    • Add #include "lib/debug.h"
Test Plan

Test that shaders work as normal and that no new error is reported (or if some are, that they are legitimate)

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Stan created this revision.Dec 7 2019, 4:03 PM
Vulcan added a comment.Dec 7 2019, 4:04 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/704/display/redirect

Stan updated this revision to Diff 10512.Dec 7 2019, 4:05 PM
Stan edited the summary of this revision. (Show Details)

Fix typo and broken indent

Vulcan added a comment.Dec 7 2019, 4:07 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/705/display/redirect

Vulcan added a comment.Dec 7 2019, 4:10 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/graphics/PreprocessorWrapper.h
|  29| class·CPreprocessorWrapper
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPreprocessorWrapper{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1220/display/redirect

Vulcan added a comment.Dec 7 2019, 4:15 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/graphics/PreprocessorWrapper.h
|  29| class·CPreprocessorWrapper
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPreprocessorWrapper{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1221/display/redirect

Stan edited the summary of this revision. (Show Details)Jan 9 2020, 4:24 PM
Stan edited the summary of this revision. (Show Details)
Stan edited the summary of this revision. (Show Details)

Did you use master version of release version (https://github.com/OGRECave/ogre/releases/tag/v1.12.4)?

I've tested the patch and made a diff between the patched version and the release version. They're different only in described steps (snprintf, ErrorHandler, etc). Compiled and tested on Windows 10 (VS2015).

source/graphics/PreprocessorWrapper.cpp
27 ↗(On Diff #10512)

It's not necessary here.

source/graphics/PreprocessorWrapper.h
42 ↗(On Diff #10512)

Wrong indent.

source/third_party/ogre3d_preprocessor/OgreGLSLPreprocessor.cpp
633 ↗(On Diff #10512)

Why commented?

source/third_party/ogre3d_preprocessor/OgreGLSLPreprocessor.h
43 ↗(On Diff #10512)

{ on the new line.

Stan updated this revision to Diff 11035.Jan 15 2020, 5:46 PM
Stan marked 4 inline comments as done.
Stan edited the summary of this revision. (Show Details)

Fix notes.

I used the version from the link above :)

source/third_party/ogre3d_preprocessor/OgreGLSLPreprocessor.cpp
633 ↗(On Diff #10512)

Was broken for bad reasons :D

Stan added a comment.Jan 15 2020, 5:48 PM

Should I replace assert ( by ENSURE?

Stan updated this revision to Diff 11036.Jan 15 2020, 5:50 PM

2019 → 2020

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/graphics/PreprocessorWrapper.cpp
|   1| /*·Copyright·(C)·2019·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2020" year instead of "2019"

source/graphics/PreprocessorWrapper.h
|   1| /*·Copyright·(C)·2019·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2020" year instead of "2019"

source/graphics/PreprocessorWrapper.h
|  29| class·CPreprocessorWrapper
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPreprocessorWrapper{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1569/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1051/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1052/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/147/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/graphics/PreprocessorWrapper.h
|  29| class·CPreprocessorWrapper
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPreprocessorWrapper{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1570/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/148/display/redirect

Stan updated this revision to Diff 11037.Jan 15 2020, 6:05 PM

assert → ensure

Stan edited the summary of this revision. (Show Details)Jan 15 2020, 6:06 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1053/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/149/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/graphics/PreprocessorWrapper.h
|  29| class·CPreprocessorWrapper
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPreprocessorWrapper{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1571/display/redirect

Stan updated this revision to Diff 11038.Jan 15 2020, 6:16 PM

Order includes, remove todo, put { on the line

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1054/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/150/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/graphics/PreprocessorWrapper.h
|  29| class·CPreprocessorWrapper
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCPreprocessorWrapper{' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1572/display/redirect

vladislavbelov accepted this revision.Jan 15 2020, 6:24 PM
This revision is now accepted and ready to land.Jan 15 2020, 6:24 PM
This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Jan 15 2020, 7:20 PM