Commit b6326326 by John Kessenich

Second round line ending clean up, from fresh round trip.

parent d49d524b
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
include_directories(MachineIndependent ../OGLCompilersDLL ${CMAKE_CURRENT_BINARY_DIR}) include_directories(MachineIndependent ../OGLCompilersDLL ${CMAKE_CURRENT_BINARY_DIR})
if(WIN32) if(WIN32)
add_subdirectory(OSDependent/Windows) add_subdirectory(OSDependent/Windows)
include_directories(${include_directories} OSDependent/Windows) include_directories(${include_directories} OSDependent/Windows)
elseif(UNIX) elseif(UNIX)
add_subdirectory(OSDependent/Linux) add_subdirectory(OSDependent/Linux)
include_directories(${include_directories} OSDependent/Linux) include_directories(${include_directories} OSDependent/Linux)
else(WIN32) else(WIN32)
message("unkown platform") message("unkown platform")
endif(WIN32) endif(WIN32)
set(SOURCES set(SOURCES
MachineIndependent/glslang.y MachineIndependent/glslang.y
MachineIndependent/Constant.cpp MachineIndependent/Constant.cpp
MachineIndependent/InfoSink.cpp MachineIndependent/InfoSink.cpp
MachineIndependent/Initialize.cpp MachineIndependent/Initialize.cpp
MachineIndependent/IntermTraverse.cpp MachineIndependent/IntermTraverse.cpp
MachineIndependent/Intermediate.cpp MachineIndependent/Intermediate.cpp
MachineIndependent/ParseHelper.cpp MachineIndependent/ParseHelper.cpp
MachineIndependent/PoolAlloc.cpp MachineIndependent/PoolAlloc.cpp
MachineIndependent/RemoveTree.cpp MachineIndependent/RemoveTree.cpp
MachineIndependent/Scan.cpp MachineIndependent/Scan.cpp
MachineIndependent/ShaderLang.cpp MachineIndependent/ShaderLang.cpp
MachineIndependent/SymbolTable.cpp MachineIndependent/SymbolTable.cpp
MachineIndependent/Versions.cpp MachineIndependent/Versions.cpp
MachineIndependent/intermOut.cpp MachineIndependent/intermOut.cpp
MachineIndependent/limits.cpp MachineIndependent/limits.cpp
MachineIndependent/linkValidate.cpp MachineIndependent/linkValidate.cpp
MachineIndependent/parseConst.cpp MachineIndependent/parseConst.cpp
MachineIndependent/reflection.cpp MachineIndependent/reflection.cpp
MachineIndependent/preprocessor/Pp.cpp MachineIndependent/preprocessor/Pp.cpp
MachineIndependent/preprocessor/PpAtom.cpp MachineIndependent/preprocessor/PpAtom.cpp
MachineIndependent/preprocessor/PpContext.cpp MachineIndependent/preprocessor/PpContext.cpp
MachineIndependent/preprocessor/PpMemory.cpp MachineIndependent/preprocessor/PpMemory.cpp
MachineIndependent/preprocessor/PpScanner.cpp MachineIndependent/preprocessor/PpScanner.cpp
MachineIndependent/preprocessor/PpSymbols.cpp MachineIndependent/preprocessor/PpSymbols.cpp
MachineIndependent/preprocessor/PpTokens.cpp MachineIndependent/preprocessor/PpTokens.cpp
GenericCodeGen/CodeGen.cpp GenericCodeGen/CodeGen.cpp
GenericCodeGen/Link.cpp) GenericCodeGen/Link.cpp)
set(HEADERS set(HEADERS
Public/ShaderLang.h Public/ShaderLang.h
Include/BaseTypes.h Include/BaseTypes.h
Include/Common.h Include/Common.h
Include/ConstantUnion.h Include/ConstantUnion.h
Include/InfoSink.h Include/InfoSink.h
Include/InitializeGlobals.h Include/InitializeGlobals.h
Include/intermediate.h Include/intermediate.h
Include/PoolAlloc.h Include/PoolAlloc.h
Include/ResourceLimits.h Include/ResourceLimits.h
Include/revision.h Include/revision.h
Include/ShHandle.h Include/ShHandle.h
Include/Types.h Include/Types.h
MachineIndependent/gl_types.h MachineIndependent/gl_types.h
MachineIndependent/Initialize.h MachineIndependent/Initialize.h
MachineIndependent/localintermediate.h MachineIndependent/localintermediate.h
MachineIndependent/ParseHelper.h MachineIndependent/ParseHelper.h
MachineIndependent/reflection.h MachineIndependent/reflection.h
MachineIndependent/RemoveTree.h MachineIndependent/RemoveTree.h
MachineIndependent/Scan.h MachineIndependent/Scan.h
MachineIndependent/ScanContext.h MachineIndependent/ScanContext.h
MachineIndependent/SymbolTable.h MachineIndependent/SymbolTable.h
MachineIndependent/unistd.h MachineIndependent/unistd.h
MachineIndependent/Versions.h MachineIndependent/Versions.h
MachineIndependent/preprocessor/PpContext.h MachineIndependent/preprocessor/PpContext.h
MachineIndependent/preprocessor/PpTokens.h) MachineIndependent/preprocessor/PpTokens.h)
find_package(BISON) find_package(BISON)
if(NOT BISON_FOUND) if(NOT BISON_FOUND)
set(BISON_EXECUTABLE ../tools/bison.exe) set(BISON_EXECUTABLE ../tools/bison.exe)
message("bison not found. Assuming it is at ${BISON_EXECUTABLE}") message("bison not found. Assuming it is at ${BISON_EXECUTABLE}")
endif() endif()
# Always use a custom command since our use of --defines isn't assumed by CMake's BISON_TARGET, # Always use a custom command since our use of --defines isn't assumed by CMake's BISON_TARGET,
# which ends up causing the target to always be rebuilt. # which ends up causing the target to always be rebuilt.
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h
COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp
MAIN_DEPENDENCY MachineIndependent/glslang.y MAIN_DEPENDENCY MachineIndependent/glslang.y
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp) set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp)
add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
if(WIN32) if(WIN32)
source_group("Public" REGULAR_EXPRESSION "Public/*") source_group("Public" REGULAR_EXPRESSION "Public/*")
source_group("MachineIndependent" REGULAR_EXPRESSION "MachineIndependent/[^/]*") source_group("MachineIndependent" REGULAR_EXPRESSION "MachineIndependent/[^/]*")
source_group("Generated Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h) source_group("Generated Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp ${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h)
source_group("Include" REGULAR_EXPRESSION "Include/[^/]*") source_group("Include" REGULAR_EXPRESSION "Include/[^/]*")
source_group("GenericCodeGen" REGULAR_EXPRESSION "GenericCodeGen/*") source_group("GenericCodeGen" REGULAR_EXPRESSION "GenericCodeGen/*")
source_group("MachineIndependent\\Preprocessor" REGULAR_EXPRESSION "MachineIndependent/preprocessor/*") source_group("MachineIndependent\\Preprocessor" REGULAR_EXPRESSION "MachineIndependent/preprocessor/*")
endif(WIN32) endif(WIN32)
install(TARGETS glslang install(TARGETS glslang
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
// The file revision.h should be updated to the latest version, somehow, on // The file revision.h should be updated to the latest version, somehow, on
// check-in, if glslang has changed. // check-in, if glslang has changed.
// //
// revision.template is the source for revision.h when using SubWCRev as the // revision.template is the source for revision.h when using SubWCRev as the
// method of updating revision.h. You don't have to do it this way, the // method of updating revision.h. You don't have to do it this way, the
// requirement is only that revision.h gets updated. // requirement is only that revision.h gets updated.
// //
// revision.h is under source control so that not all consumers of glslang // revision.h is under source control so that not all consumers of glslang
// source have to figure out how to create revision.h just to get a build // source have to figure out how to create revision.h just to get a build
// going. However, if it is not updated, it can be a version behind. // going. However, if it is not updated, it can be a version behind.
#define GLSLANG_REVISION "25512" #define GLSLANG_REVISION "25512"
#define GLSLANG_DATE "2014/02/24 14:36:08" #define GLSLANG_DATE "2014/02/24 14:36:08"
// //
//Copyright (C) 2013 LunarG, Inc. //Copyright (C) 2013 LunarG, Inc.
// //
//All rights reserved. //All rights reserved.
// //
//Redistribution and use in source and binary forms, with or without //Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions //modification, are permitted provided that the following conditions
//are met: //are met:
// //
// Redistributions of source code must retain the above copyright // Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
// //
// Redistributions in binary form must reproduce the above // Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following // copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided // disclaimer in the documentation and/or other materials provided
// with the distribution. // with the distribution.
// //
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
// contributors may be used to endorse or promote products derived // contributors may be used to endorse or promote products derived
// from this software without specific prior written permission. // from this software without specific prior written permission.
// //
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//POSSIBILITY OF SUCH DAMAGE. //POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef _REFLECTION_INCLUDED #ifndef _REFLECTION_INCLUDED
#define _REFLECTION_INCLUDED #define _REFLECTION_INCLUDED
#include "../Public/ShaderLang.h" #include "../Public/ShaderLang.h"
#include <list> #include <list>
#include <set> #include <set>
// //
// A reflection database and its interface, consistent with the OpenGL API reflection queries. // A reflection database and its interface, consistent with the OpenGL API reflection queries.
// //
namespace glslang { namespace glslang {
class TIntermediate; class TIntermediate;
class TIntermAggregate; class TIntermAggregate;
class TLiveTraverser; class TLiveTraverser;
// Data needed for just a single object at the granularity exchanged by the reflection API // Data needed for just a single object at the granularity exchanged by the reflection API
class TObjectReflection { class TObjectReflection {
public: public:
TObjectReflection(const TString& pName, int pOffset, int pGLDefineType, int pSize, int pIndex) : TObjectReflection(const TString& pName, int pOffset, int pGLDefineType, int pSize, int pIndex) :
name(pName), offset(pOffset), glDefineType(pGLDefineType), size(pSize), index(pIndex) { } name(pName), offset(pOffset), glDefineType(pGLDefineType), size(pSize), index(pIndex) { }
void dump() const { printf("%s: offset %d, type %x, size %d, index %d\n", name.c_str(), offset, glDefineType, size, index); } void dump() const { printf("%s: offset %d, type %x, size %d, index %d\n", name.c_str(), offset, glDefineType, size, index); }
TString name; TString name;
int offset; int offset;
int glDefineType; int glDefineType;
int size; // data size in bytes for a block, array size for a (non-block) object that's an array int size; // data size in bytes for a block, array size for a (non-block) object that's an array
int index; int index;
}; };
// The full reflection database // The full reflection database
class TReflection { class TReflection {
public: public:
TReflection() : badReflection("__bad__", -1, -1, -1, -1) {} TReflection() : badReflection("__bad__", -1, -1, -1, -1) {}
virtual ~TReflection() {} virtual ~TReflection() {}
// grow the reflection stage by stage // grow the reflection stage by stage
bool addStage(EShLanguage, const TIntermediate&); bool addStage(EShLanguage, const TIntermediate&);
// for mapping a uniform index to a uniform object's description // for mapping a uniform index to a uniform object's description
int getNumUniforms() { return (int)indexToUniform.size(); } int getNumUniforms() { return (int)indexToUniform.size(); }
const TObjectReflection& getUniform(int i) const const TObjectReflection& getUniform(int i) const
{ {
if (i >= 0 && i < (int)indexToUniform.size()) if (i >= 0 && i < (int)indexToUniform.size())
return indexToUniform[i]; return indexToUniform[i];
else else
return badReflection; return badReflection;
} }
// for mapping a block index to the block's description // for mapping a block index to the block's description
int getNumUniformBlocks() const { return (int)indexToUniformBlock.size(); } int getNumUniformBlocks() const { return (int)indexToUniformBlock.size(); }
const TObjectReflection& getUniformBlock(int i) const const TObjectReflection& getUniformBlock(int i) const
{ {
if (i >= 0 && i < (int)indexToUniformBlock.size()) if (i >= 0 && i < (int)indexToUniformBlock.size())
return indexToUniformBlock[i]; return indexToUniformBlock[i];
else else
return badReflection; return badReflection;
} }
// for mapping any name to its index (both block names and uniforms names) // for mapping any name to its index (both block names and uniforms names)
int getIndex(const char* name) const int getIndex(const char* name) const
{ {
TNameToIndex::const_iterator it = nameToIndex.find(name); TNameToIndex::const_iterator it = nameToIndex.find(name);
if (it == nameToIndex.end()) if (it == nameToIndex.end())
return -1; return -1;
else else
return it->second; return it->second;
} }
void dump(); void dump();
protected: protected:
friend class glslang::TLiveTraverser; friend class glslang::TLiveTraverser;
typedef std::map<TString, int> TNameToIndex; typedef std::map<TString, int> TNameToIndex;
typedef std::vector<TObjectReflection> TMapIndexToReflection; typedef std::vector<TObjectReflection> TMapIndexToReflection;
TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this
TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed
TMapIndexToReflection indexToUniform; TMapIndexToReflection indexToUniform;
TMapIndexToReflection indexToUniformBlock; TMapIndexToReflection indexToUniformBlock;
}; };
} // end namespace glslang } // end namespace glslang
#endif // _REFLECTION_INCLUDED #endif // _REFLECTION_INCLUDED
...@@ -6,5 +6,5 @@ include_directories(. ../../../OGLCompilersDLL) ...@@ -6,5 +6,5 @@ include_directories(. ../../../OGLCompilersDLL)
add_library(OSDependent STATIC ossource.cpp osinclude.h) add_library(OSDependent STATIC ossource.cpp osinclude.h)
install(TARGETS OSDependent install(TARGETS OSDependent
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
include_directories(. ../../../OGLCompilersDLL) include_directories(. ../../../OGLCompilersDLL)
set(SOURCES ossource.cpp osinclude.h) set(SOURCES ossource.cpp osinclude.h)
add_library(OSDependent STATIC ${SOURCES}) add_library(OSDependent STATIC ${SOURCES})
if(WIN32) if(WIN32)
source_group("Source" FILES ${SOURCES}) source_group("Source" FILES ${SOURCES})
endif(WIN32) endif(WIN32)
install(TARGETS OSDependent install(TARGETS OSDependent
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment