Move Ogre3D GLSL Preprocessor to a third_party folder and restore its original name. Also restore the Wrapper name to reflect what it's wrapping and move it to renderer.
Reviewed by: @Angen Comments by: @elexis Differential Revision: https://code.wildfiregames.com/D2338 This was SVN commit r23215.
This commit is contained in:
parent
57abe7a644
commit
aef0c3c13a
@ -730,7 +730,8 @@ function setup_all_libs ()
|
||||
"graphics/scripting",
|
||||
"renderer",
|
||||
"renderer/scripting",
|
||||
"third_party/mikktspace"
|
||||
"third_party/mikktspace",
|
||||
"third_party/ogre3d_preprocessor"
|
||||
}
|
||||
extern_libs = {
|
||||
"opengl",
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
#include "MaterialManager.h"
|
||||
|
||||
#include "graphics/PreprocessorWrapper.h"
|
||||
#include "lib/ogl.h"
|
||||
#include "maths/MathUtil.h"
|
||||
#include "maths/Vector4D.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/PreprocessorWrapper.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
#include "renderer/RenderingOptions.h"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -22,6 +22,19 @@
|
||||
#include "graphics/ShaderDefines.h"
|
||||
#include "ps/CLogger.h"
|
||||
|
||||
void CPreprocessorWrapper::PyrogenesisShaderError(void* UNUSED(iData), int iLine, const char* iError, const char* iToken, size_t iTokenLen)
|
||||
{
|
||||
if (iToken)
|
||||
LOGERROR("Preprocessor error: line %d: %s: '%s'\n", iLine, iError, std::string(iToken, iTokenLen).c_str());
|
||||
else
|
||||
LOGERROR("Preprocessor error: line %d: %s\n", iLine, iError);
|
||||
}
|
||||
|
||||
CPreprocessorWrapper::CPreprocessorWrapper()
|
||||
{
|
||||
CPreprocessor::ErrorHandler = CPreprocessorWrapper::PyrogenesisShaderError;
|
||||
}
|
||||
|
||||
void CPreprocessorWrapper::AddDefine(const char* name, const char* value)
|
||||
{
|
||||
m_Preprocessor.Define(name, value);
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -18,8 +18,8 @@
|
||||
#ifndef INCLUDED_PREPROCESSORWRAPPER
|
||||
#define INCLUDED_PREPROCESSORWRAPPER
|
||||
|
||||
#include "ps/Preprocessor.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "third_party/ogre3d_preprocessor/OgreGLSLPreprocessor.h"
|
||||
|
||||
class CShaderDefines;
|
||||
|
||||
@ -29,6 +29,8 @@ class CShaderDefines;
|
||||
class CPreprocessorWrapper
|
||||
{
|
||||
public:
|
||||
CPreprocessorWrapper();
|
||||
|
||||
void AddDefine(const char* name, const char* value);
|
||||
|
||||
void AddDefines(const CShaderDefines& defines);
|
||||
@ -37,6 +39,8 @@ public:
|
||||
|
||||
CStr Preprocess(const CStr& input);
|
||||
|
||||
static void PyrogenesisShaderError(void* UNUSED(iData), int iLine, const char* iError, const char* iToken, size_t iTokenLen);
|
||||
|
||||
private:
|
||||
CPreprocessor m_Preprocessor;
|
||||
};
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "ShaderManager.h"
|
||||
|
||||
#include "graphics/PreprocessorWrapper.h"
|
||||
#include "graphics/ShaderTechnique.h"
|
||||
#include "lib/config2.h"
|
||||
#include "lib/hash.h"
|
||||
@ -27,7 +28,6 @@
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/PreprocessorWrapper.h"
|
||||
#include "ps/Profile.h"
|
||||
#if USE_SHADER_XML_VALIDATION
|
||||
# include "ps/XML/RelaxNG.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "ShaderProgram.h"
|
||||
|
||||
#include "graphics/Color.h"
|
||||
#include "graphics/PreprocessorWrapper.h"
|
||||
#include "graphics/ShaderManager.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "lib/res/graphics/ogl_tex.h"
|
||||
@ -27,7 +28,6 @@
|
||||
#include "maths/Vector3D.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/PreprocessorWrapper.h"
|
||||
|
||||
#if !CONFIG2_GLES
|
||||
|
||||
|
@ -34,9 +34,7 @@ THE SOFTWARE.
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Preprocessor.h"
|
||||
|
||||
#include "ps/CLogger.h"
|
||||
#include "OgreGLSLPreprocessor.h"
|
||||
|
||||
// Limit max number of macro arguments to this
|
||||
#define MAX_MACRO_ARGS 16
|
||||
@ -230,11 +228,12 @@ static void DefaultError (void *iData, int iLine, const char *iError,
|
||||
const char *iToken, size_t iTokenLen)
|
||||
{
|
||||
(void)iData;
|
||||
char line [1000];
|
||||
if (iToken)
|
||||
LOGERROR("Preprocessor error: line %d: %s: '%s'\n",
|
||||
iLine, iError, std::string (iToken, iTokenLen));
|
||||
snprintf (line, sizeof (line), "line %d: %s: `%.*s'\n",
|
||||
iLine, iError, int (iTokenLen), iToken);
|
||||
else
|
||||
LOGERROR("Preprocessor error: line %d: %s\n", iLine, iError);
|
||||
snprintf (line, sizeof (line), "line %d: %s\n", iLine, iError);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------//
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2016 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -17,11 +17,17 @@
|
||||
|
||||
#include "lib/self_test.h"
|
||||
|
||||
#include "ps/Preprocessor.h"
|
||||
#include "graphics/PreprocessorWrapper.h"
|
||||
#include "third_party/ogre3d_preprocessor/OgreGLSLPreprocessor.h"
|
||||
|
||||
class TestPreprocessor : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
void setUp()
|
||||
{
|
||||
CPreprocessor::ErrorHandler = CPreprocessorWrapper::PyrogenesisShaderError;
|
||||
}
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
CPreprocessor preproc;
|
Loading…
Reference in New Issue
Block a user