Open Kuranes opened 6 years ago
It's not implemented yet, but sounds like a good idea. I don't have much time at the moment so a pull request would be definitely appreciated.
Ok I'll have a go then.
( I'd like to check about implementing -D flag (preprocess glsl only, no compilation) too if possible, would allow to double check real code compiled)
For now, first try at compiliing on ubuntu 16 is a no go ( emcc 1.22.1, clang 3.8 )
npm install
apt install build-essentials llvm clang emscripten
export EMSCRIPTEN=/usr/share/emscripten
grunt build
gives me compilation errors
`[ 2%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/ShaderLang.cpp.o
In file included from /sources/experiments/glslang.js/externals/glslang/glslang/MachineIndependent/ShaderLang.cpp:44:
In file included from /usr/share/emscripten/system/include/libcxx/iostream:38:
In file included from /usr/share/emscripten/system/include/libcxx/ios:216:
In file included from /usr/share/emscripten/system/include/libcxx/locale:15:
In file included from /usr/share/emscripten/system/include/libcxx/string:439:
In file included from /usr/share/emscripten/system/include/libcxx/algorithm:624:
/usr/share/emscripten/system/include/libcxx/type_traits:433:76: error: no matching function for call to '__source'
: public integral_constant<bool, sizeof(is_function_imp::test<_Tp>(is_function_imp::source<_Tp>())) == 1>
^~~~~~~~
/usr/share/emscripten/system/include/libcxx/type_traits:438:14: note: in instantiation of template class 'std::1::is_function<int () const, false>' requested here
: public is_function<_Tp> {};
^
/usr/share/emscripten/system/include/libcxx/type_traits:443:90: note: in instantiation of template class 'std::1::is_function<int () const>' requested here
template <class _Tp, class _Up> struct is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
^
/usr/share/emscripten/system/include/libcxx/type_traits:446:14: note: in instantiation of template class 'std::1::__is_member_function_pointer<int (glslang::TInputScanner::*)() const>' requested here
: public is_member_function_pointer<typename remove_cv<_Tp>::type> {};
^
/usr/share/emscripten/system/include/libcxx/type_traits:460:38: note: in instantiation of template class 'std::1::is_member_function_pointer<int (glslang::TInputScanner::*)() const>' requested here
!is_member_function_pointer<_Tp>::value> {};
^
/usr/share/emscripten/system/include/libcxx/type_traits:3093:17: note: in instantiation of template class 'std::1::is_member_object_pointer<int (glslang::TInputScanner::)() const>' requested here
is_member_object_pointer<typename remove_reference<_Fp>::type>::value &&
^
/usr/share/emscripten/system/include/libcxx/type_traits:3100:1: note: (skipping 7 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
invoke(_Fp&& __f, _A0&& a0)
^
/usr/share/emscripten/system/include/libcxx/type_traits:3118:13: note: while substituting deduced template arguments into function template '__invoke' [with _Fp = std::1::bind<int
(glslang::TInputScanner::)() const, glslang::TInputScanner > &, _Args = <>]
invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
^
/usr/share/emscripten/system/include/libcxx/type_traits:3126:11: note: in instantiation of template class 'std::1::invokable_imp<std::1::__bind<int (glslang::TInputScanner::)() const,
glslang::TInputScanner > &>' requested here
__invokable_imp<_Fp, _Args...>::value>
^
/usr/share/emscripten/system/include/libcxx/functional:1427:33: note: in instantiation of template class 'std::1::invokable<std::1::bind<int (glslang::TInputScanner::)() const, glslang::TInputScanner
> &>' requested here
invokable<_Fp&, _ArgTypes...>::value>
^
/usr/share/emscripten/system/include/libcxx/functional:1454:41: note: in instantiation of default argument for 'callable<std::1::bind<int (glslang::TInputScanner::)() const, glslang::TInputScanner > >'
required here
callable<_Fp>::value &&
^~~~~~~
/sources/experiments/glslang.js/externals/glslang/glslang/MachineIndependent/ShaderLang.cpp:702:13: note: while substituting deduced template arguments into function template 'function' [with _Fp =
std::1::__bind<int (glslang::TInputScanner::)() const, glslang::TInputScanner *>]
std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputStream);
^
/usr/share/emscripten/system/include/libcxx/type_traits:424:28: note: candidate template ignored: substitution failure [with _Tp = int () const]: reference to function type 'int () const' cannot have 'const'
qualifier
template
/sources/experiments/glslang.js/externals/glslang/glslang/MachineIndependent/ShaderLang.cpp:701:32: error: no matching constructor for initialization of '(anonymous namespace)::SourceLineSynchronizer'
SourceLineSynchronizer lineSync(
^
/sources/experiments/glslang.js/externals/glslang/glslang/MachineIndependent/ShaderLang.cpp:625:5: note: candidate constructor not viable: no known conversion from '__bind<int (glslang::TInputScanner::*)()
const, glslang::TInputScanner *>' to 'const std::function<int ()>' for 1st argument
SourceLineSynchronizer(const std::function<int()>& lastSourceIndex,
^
/sources/experiments/glslang.js/externals/glslang/glslang/MachineIndependent/ShaderLang.cpp:623:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were
provided
class SourceLineSynchronizer {
^
/sources/experiments/glslang.js/externals/glslang/glslang/MachineIndependent/ShaderLang.cpp:623:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were
provided
2 errors generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
glslang/CMakeFiles/glslang.dir/build.make:309: recipe for target 'glslang/CMakeFiles/glslang.dir/MachineIndependent/ShaderLang.cpp.o' failed
make[2]: *** [glslang/CMakeFiles/glslang.dir/MachineIndependent/ShaderLang.cpp.o] Error 1
`
Looks like maybe a problem with version between llvm/emscripten/glslang
Next time i'll try with latest emscripten "portable" tgz and see where it goes.
Would there be a way to get info log from the compiler ?
Like the standalone glslvalidator does