From: John Kessenich Date: Mon, 28 Jul 2014 04:21:04 +0000 (+0000) Subject: Create dummy side project. X-Git-Tag: upstream/0.1~676 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92f9038388be7d6e6be361f45d6df087dbeb42c7;p=platform%2Fupstream%2Fglslang.git Create dummy side project. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27519 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- diff --git a/BIL/Bil.h b/BIL/Bil.h new file mode 100644 index 0000000..f9ab2c4 --- /dev/null +++ b/BIL/Bil.h @@ -0,0 +1,6 @@ + +#pragma once +#ifndef Bil_H +#define Bil_H + +#endif // Bil_H diff --git a/BIL/BilBuilder.cpp b/BIL/BilBuilder.cpp new file mode 100644 index 0000000..e39c9f1 --- /dev/null +++ b/BIL/BilBuilder.cpp @@ -0,0 +1,59 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#include + +#include "BilBuilder.h" + +#ifndef _WIN32 + #include +#endif + +namespace glbil { + +Builder::Builder() +{ +} + +Builder::~Builder() +{ +} + +void MissingFunctionality(const char* fun) +{ + printf("Missing functionality: %s\n", fun); + exit(1); +} + +}; // end glbil namespace diff --git a/BIL/BilBuilder.h b/BIL/BilBuilder.h new file mode 100644 index 0000000..ba993d4 --- /dev/null +++ b/BIL/BilBuilder.h @@ -0,0 +1,56 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#pragma once +#ifndef BilBuilder_H +#define BilBuilder_H + +#include "Bil.h" +#include "Bir.h" + +#include + +namespace glbil { + +class Builder { +public: + Builder(); + virtual ~Builder(); +}; + +void MissingFunctionality(const char*); + +}; // end glbil namespace + +#endif // BilBuilder_H diff --git a/BIL/BilDisassemble.cpp b/BIL/BilDisassemble.cpp new file mode 100644 index 0000000..6425b86 --- /dev/null +++ b/BIL/BilDisassemble.cpp @@ -0,0 +1,35 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#include "BilDisassemble.h" diff --git a/BIL/BilDisassemble.h b/BIL/BilDisassemble.h new file mode 100644 index 0000000..3400675 --- /dev/null +++ b/BIL/BilDisassemble.h @@ -0,0 +1,36 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#include "Bil.h" + diff --git a/BIL/Bir.h b/BIL/Bir.h new file mode 100644 index 0000000..eee9dec --- /dev/null +++ b/BIL/Bir.h @@ -0,0 +1,49 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#pragma once +#ifndef Bir_H +#define Bir_H + +#include "Bil.h" + +#include +#include + +namespace glbil { + + +}; // end glbil namespace + +#endif // Bir_H diff --git a/BIL/CMakeLists.txt b/BIL/CMakeLists.txt new file mode 100644 index 0000000..a6b4251 --- /dev/null +++ b/BIL/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8) + +include_directories(.. ${CMAKE_CURRENT_BINARY_DIR}) + +set(SOURCES + GlslangToBil.cpp + BilBuilder.cpp + BilDisassemble.cpp) + +set(HEADERS + GlslangToBil.h + BilBuilder.h + Bir.h + BilDisassemble.h) + +add_library(BIL STATIC ${SOURCES} ${HEADERS}) + +if(WIN32) + source_group("Source" FILES ${SOURCES} ${HEADERS}) +endif(WIN32) + +install(TARGETS BIL + ARCHIVE DESTINATION lib) diff --git a/BIL/GlslangToBil.cpp b/BIL/GlslangToBil.cpp new file mode 100644 index 0000000..bb48a6e --- /dev/null +++ b/BIL/GlslangToBil.cpp @@ -0,0 +1,50 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#include "Bil.h" +#include "GlslangToBil.h" +#include "BilBuilder.h" +#include "BilDisassemble.h" + +// Glslang includes +#include "glslang/MachineIndependent/localintermediate.h" +#include "glslang/MachineIndependent/SymbolTable.h" + +namespace glslang { + +void GlslangToBil(const glslang::TIntermediate& intermediate) +{ +} + +}; // end namespace glslang diff --git a/BIL/GlslangToBil.h b/BIL/GlslangToBil.h new file mode 100644 index 0000000..b030fe3 --- /dev/null +++ b/BIL/GlslangToBil.h @@ -0,0 +1,41 @@ +// +//Copyright (C) 2014 LunarG, Inc. +// +//All rights reserved. +// +//Redistribution and use in source and binary forms, with or without +//modification, are permitted provided that the following conditions +//are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +//POSSIBILITY OF SUCH DAMAGE. + +#include "../glslang/Include/intermediate.h" + +namespace glslang { + +void GlslangToBil(const glslang::TIntermediate& intermediate); + +}; diff --git a/CMakeLists.txt b/CMakeLists.txt index 2746f8b..d852c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,3 +16,4 @@ endif(WIN32) add_subdirectory(glslang) add_subdirectory(OGLCompilersDLL) add_subdirectory(StandAlone) +add_subdirectory(BIL) diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index 4c60c4a..ec4ba66 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -16,7 +16,8 @@ add_executable(glslangValidator ${SOURCES}) set(LIBRARIES glslang OGLCompiler - OSDependent) + OSDependent + BIL) if(WIN32) set(LIBRARIES ${LIBRARIES} psapi) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 10da8e1..8d3f5ca 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -40,6 +40,7 @@ #include "Worklist.h" #include "./../glslang/Include/ShHandle.h" #include "./../glslang/Public/ShaderLang.h" +#include "../BIL/GlslangToBil.h" #include #include #include @@ -64,6 +65,7 @@ enum TOptions { EOptionDumpReflection = 0x100, EOptionSuppressWarnings = 0x200, EOptionDumpVersions = 0x400, + EOptionBil = 0x800, }; // @@ -464,6 +466,9 @@ bool ProcessArguments(int argc, char* argv[]) Work[argc] = 0; if (argv[0][0] == '-') { switch (argv[0][1]) { + case 'b': + Options |= EOptionBil; + break; case 'c': Options |= EOptionDumpConfig; break; @@ -615,6 +620,17 @@ void CompileAndLinkShaders() program.dumpReflection(); } + if (Options & EOptionBil) { + if (CompileFailed || LinkFailed) + printf("Bil is not generated for failed compile or link\n"); + else { + for (int stage = 0; stage < EShLangCount; ++stage) { + if (program.getIntermediate((EShLanguage)stage)) + glslang::GlslangToBil(*program.getIntermediate((EShLanguage)stage)); + } + } + } + // Free everything up, program has to go before the shaders // because it might have merged stuff from the shaders, and // the stuff from the shaders has to have its destructors called @@ -813,6 +829,7 @@ void usage() "\n" "To get other information, use one of the following options:\n" "(Each option must be specified separately, but can go anywhere in the command line.)\n" + " -b create BIL\n" " -c configuration dump; use to create default configuration file (redirect to a .conf file)\n" " -i intermediate tree (glslang AST) is printed out\n" " -l link validation of all input files\n" diff --git a/StandAlone/Worklist.h b/StandAlone/Worklist.h index 1dabec9..c304007 100644 --- a/StandAlone/Worklist.h +++ b/StandAlone/Worklist.h @@ -48,6 +48,7 @@ namespace glslang { name(s) { } std::string name; std::string results; + std::string resultsIndex; }; class TWorklist { diff --git a/Todo.txt b/Todo.txt index 6549c97..afd370a 100644 --- a/Todo.txt +++ b/Todo.txt @@ -1,5 +1,8 @@ Current functionality level: ESSL 3.0, GLSL 1.5 +Bugs + - implicitly-sized gl_ClipDistance[] (at least in tessellation shaders) with sizes greater than one are not getting sizes greater than one + + create version system Link Validation diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 42ce63b..9ab22eb 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -479,6 +479,10 @@ public: return layoutLocation != layoutLocationEnd || layoutComponent != layoutComponentEnd; } + bool hasComponent() const + { + return layoutComponent != layoutComponentEnd; + } bool hasBinding() const { return layoutBinding != layoutBindingEnd;