New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes ported from bitbucket #16
Conversation
* Non square matrices are glsl > 1.20 * Use glsl matrix conversion functions (> 1.20 too) * various cleanups
HLSL does not seems to follow Cg matching rules, for example, according to Cg rules, lerp(float, float3, float) should call lerp(float, float, float), but HLSL calls lerp(float3, float3, float3). In order to achieve that, arguments are iterated over from biggest vector to lowest instead of left to right. this also fix TType::determineCompatibility
1..xxxx and array[float(1)] are now supported
Hi, I wonder what the story is behind the deletion of unistd.h? I could not build on Visual Studio 2010 off of CMakeLists.txt, so I had to patch it up a little. See juj@fd3b8af and juj@fb9144a . |
Aras's mainline does not build from CMakeLists.txt on Visual Studio 10, and I could not figure out how. It succeeds on top of the fixes in this pull request plus those two that I listed above. Running the tests on Aras's master head, built with the VS .sln file in the repository gives me a crash. Running the tests off of this juj@fb9144a gives me 102 tests, 102 FAILED, 0.77s This seem to be caused by the comparison if (text != output) in hlsl2glsltest.cpp, where text has LF line endings and output has CRLF line endings in each test. |
@mawww: I'm down with flu right now, will look at your patch hopefully next week. @juj: don't see how this is related to Maxime's pull request. I've never tried building with Visual Studio using cmake; I don't know if CMakeLists even works. I'm maintaining native VS & Xcode project files; cmake path is something that someone else contributed. It may or it might not work. |
regarding the unistd.h, it breaked compilation under linux and just adding an empty file to override standard one seemed like a bad solution, I did not test under windows (using hlsl2glsl own build system, I did compile it in our own codebase, using our internal build system), but I believe the nice solution is to define YY_NO_UNISTD_H in the windows compilation options. |
Looking at YY_NO_UNISTD_H, there's no effect if that is defined when compiling hlsl2glsl itself. The file unistd.h is included unconditionally in the generated file. Looking around the net, I understand some other (newer?) version of flex would generate files that have unistd.h wrapped inside this macro, but the one in the tools/ folder doesn't? Or is YY_NO_UNISTD_H something I should pass to flex in its generation pass? |
I think it's the version in tools/ which is too old, maybe you can find an updated version for windows ? |
Checking in the codebase, the versions are as follows: C:\Projects\hlsl2glsl\tools>bison --version C:\Projects\hlsl2glsl\tools>flex --version I'll try with a newer version. |
So far I have been unable to update to a newer flex + bison version. One attempt resulted at this: Another attempt to install bison from 2.4.1 from http://gnuwin32.sourceforge.net/packages/bison.htm results in 1> Executing Bison on hlslang.y I'll try to dig deeper when I get more time. |
@mawww: merging your changes now, will take a while. I still absolutely need pre-GLSL 1.20 support (mostly for mobile, since OpenGL ES 2.0 language is based on GLSL 1.10 - so no non-square matrices, no downcasting matrices into smaller ones etc.). Stay tuned. |
* line endings to LF * yyerror takes a const char* instead of a char* * binary not is ~, not - * enable some bitwise operations as supported features * add missing outES test files * fix empty body if handling * fix cast on function call * add struct initialisation by scalar support * fix global-init test * add (shotgun style) coverage mask support * Fix inverted left and right shift operators * fix EOpRightShiftAssign output, >>=, not ??= * promote constant union to right type, plus fixes * Add support for more semantics * Add tests for tokenpasting and global initialization * add execute permission to bison and flex * various swizzle and arrays fixes. * Fix bad order in HLSL matrix rows/columns, add definitions for mul(float.*, float.*) * update tests results matrix non square * fix in type construction for swizzle * Add overloading tests * handle upward vector promotion in TSymbolTableLevel::findCompatible… * Add test for non-square matrix and vector promotion * Fix vector upward promotion for single argument functions * Add support for non square matrices * remove unistd.h * fix CMakeList * hlsl2glsltest: add glut fallback version
* yyerror takes a const char* instead of a char* * binary not is ~, not - * enable some bitwise operations as supported features * add missing outES test files * fix empty body if handling * fix cast on function call * add struct initialisation by scalar support * fix global-init test * add (shotgun style) coverage mask support * Fix inverted left and right shift operators * fix EOpRightShiftAssign output, >>=, not ??= * promote constant union to right type, plus fixes * Add support for more semantics * Add tests for tokenpasting and global initialization * add execute permission to bison and flex * various swizzle and arrays fixes. * Fix bad order in HLSL matrix rows/columns, add definitions for mul(float.*, float.*) * update tests results matrix non square * fix in type construction for swizzle * Add overloading tests * handle upward vector promotion in TSymbolTableLevel::findCompatible… * Add test for non-square matrix and vector promotion * Fix vector upward promotion for single argument functions * Add support for non square matrices * remove unistd.h * fix CMakeList * hlsl2glsltest: add glut fallback version
Finally merged this one in, thanks! Took a while since I still absolutely need GLSL versions that don't have non-square matrices or built-in matrix downcasts (OpenGL ES 2.0...). |
Hello Aras,
I took some time to rebase my fork of hlsl2glslfork onto the new git code, looks to work well for our shaders at Eugen Systems, maybe you'd like to merge or cherry pick some of these.
Cheers,
Maxime.