--- /dev/null
+\r
+#pragma once\r
+#ifndef Bil_H\r
+#define Bil_H\r
+\r
+#endif // Bil_H\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#include <assert.h>\r
+\r
+#include "BilBuilder.h"\r
+\r
+#ifndef _WIN32\r
+ #include <cstdio>\r
+#endif\r
+\r
+namespace glbil {\r
+\r
+Builder::Builder()\r
+{\r
+}\r
+\r
+Builder::~Builder()\r
+{\r
+}\r
+\r
+void MissingFunctionality(const char* fun)\r
+{\r
+ printf("Missing functionality: %s\n", fun);\r
+ exit(1);\r
+}\r
+\r
+}; // end glbil namespace\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#pragma once\r
+#ifndef BilBuilder_H\r
+#define BilBuilder_H\r
+\r
+#include "Bil.h"\r
+#include "Bir.h"\r
+\r
+#include <stack>\r
+\r
+namespace glbil {\r
+\r
+class Builder {\r
+public:\r
+ Builder();\r
+ virtual ~Builder();\r
+};\r
+\r
+void MissingFunctionality(const char*);\r
+\r
+}; // end glbil namespace\r
+\r
+#endif // BilBuilder_H\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#include "BilDisassemble.h"\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#include "Bil.h"\r
+\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#pragma once\r
+#ifndef Bir_H\r
+#define Bir_H\r
+\r
+#include "Bil.h"\r
+\r
+#include <vector>\r
+#include <iostream>\r
+\r
+namespace glbil {\r
+\r
+\r
+}; // end glbil namespace\r
+\r
+#endif // Bir_H\r
--- /dev/null
+cmake_minimum_required(VERSION 2.8)\r
+\r
+include_directories(.. ${CMAKE_CURRENT_BINARY_DIR})\r
+\r
+set(SOURCES\r
+ GlslangToBil.cpp\r
+ BilBuilder.cpp\r
+ BilDisassemble.cpp)\r
+\r
+set(HEADERS\r
+ GlslangToBil.h\r
+ BilBuilder.h\r
+ Bir.h\r
+ BilDisassemble.h)\r
+\r
+add_library(BIL STATIC ${SOURCES} ${HEADERS})\r
+\r
+if(WIN32)\r
+ source_group("Source" FILES ${SOURCES} ${HEADERS})\r
+endif(WIN32)\r
+\r
+install(TARGETS BIL\r
+ ARCHIVE DESTINATION lib)\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#include "Bil.h"\r
+#include "GlslangToBil.h"\r
+#include "BilBuilder.h"\r
+#include "BilDisassemble.h"\r
+\r
+// Glslang includes\r
+#include "glslang/MachineIndependent/localintermediate.h"\r
+#include "glslang/MachineIndependent/SymbolTable.h"\r
+\r
+namespace glslang {\r
+\r
+void GlslangToBil(const glslang::TIntermediate& intermediate)\r
+{\r
+}\r
+\r
+}; // end namespace glslang\r
--- /dev/null
+//\r
+//Copyright (C) 2014 LunarG, Inc.\r
+//\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+// Redistributions of source code must retain the above copyright\r
+// notice, this list of conditions and the following disclaimer.\r
+//\r
+// Redistributions in binary form must reproduce the above\r
+// copyright notice, this list of conditions and the following\r
+// disclaimer in the documentation and/or other materials provided\r
+// with the distribution.\r
+//\r
+// Neither the name of 3Dlabs Inc. Ltd. nor the names of its\r
+// contributors may be used to endorse or promote products derived\r
+// from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+\r
+#include "../glslang/Include/intermediate.h"\r
+\r
+namespace glslang {\r
+\r
+void GlslangToBil(const glslang::TIntermediate& intermediate);\r
+\r
+};\r
add_subdirectory(glslang)\r
add_subdirectory(OGLCompilersDLL)\r
add_subdirectory(StandAlone)\r
+add_subdirectory(BIL)\r
set(LIBRARIES\r
glslang\r
OGLCompiler\r
- OSDependent)\r
+ OSDependent\r
+ BIL)\r
\r
if(WIN32)\r
set(LIBRARIES ${LIBRARIES} psapi)\r
#include "Worklist.h"
#include "./../glslang/Include/ShHandle.h"
#include "./../glslang/Public/ShaderLang.h"
+#include "../BIL/GlslangToBil.h"
#include <string.h>
#include <stdlib.h>
#include <math.h>
EOptionDumpReflection = 0x100,
EOptionSuppressWarnings = 0x200,
EOptionDumpVersions = 0x400,
+ EOptionBil = 0x800,
};
//
Work[argc] = 0;
if (argv[0][0] == '-') {
switch (argv[0][1]) {
+ case 'b':
+ Options |= EOptionBil;
+ break;
case 'c':
Options |= EOptionDumpConfig;
break;
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
"\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"
name(s) { }
std::string name;
std::string results;
+ std::string resultsIndex;
};
class TWorklist {
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
return layoutLocation != layoutLocationEnd ||
layoutComponent != layoutComponentEnd;
}
+ bool hasComponent() const
+ {
+ return layoutComponent != layoutComponentEnd;
+ }
bool hasBinding() const
{
return layoutBinding != layoutBindingEnd;