Skip to content
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

Merged
merged 27 commits into from Feb 24, 2013
Merged

Fixes ported from bitbucket #16

merged 27 commits into from Feb 24, 2013

Conversation

mawww
Copy link

@mawww mawww commented Dec 7, 2012

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.

Maxime Coste added 27 commits December 7, 2012 16:41
* 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
@juj
Copy link

juj commented Dec 11, 2012

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 .

@juj
Copy link

juj commented Dec 11, 2012

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.

@aras-p
Copy link
Owner

aras-p commented Dec 12, 2012

@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.

@mawww
Copy link
Author

mawww commented Dec 12, 2012

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.

@juj
Copy link

juj commented Dec 12, 2012

@aras-p : No worries, I'll try to clear out issues related to that. Have you encountered CRLF vs LF issues on tests on Windows?

@mawww: That sounds like a much better way, I'll see if I can adapt the Windows build to use that instead.

@juj
Copy link

juj commented Dec 12, 2012

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?

@mawww
Copy link
Author

mawww commented Dec 12, 2012

I think it's the version in tools/ which is too old, maybe you can find an updated version for windows ?
Windows compilation works here with YY_NO_UNISTD_H, flex 2.5.35 and bison 2.4.2 on our own build system.

@juj
Copy link

juj commented Dec 12, 2012

Checking in the codebase, the versions are as follows:

C:\Projects\hlsl2glsl\tools>bison --version
GNU Bison version 1.24

C:\Projects\hlsl2glsl\tools>flex --version
flex version 2.5.2

I'll try with a newer version.

@juj
Copy link

juj commented Dec 13, 2012

So far I have been unable to update to a newer flex + bison version. One attempt resulted at this:

http://pastebin.com/cdTt4Cdx

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
1> ....\tools\bison.exe: cannot open file `c:/progra~1/bison/share/bison/m4sugar/m4sugar.m4': No such file or directory
1> ....\tools\bison.exe: m4: No such file or directory

I'll try to dig deeper when I get more time.

@aras-p
Copy link
Owner

aras-p commented Dec 18, 2012

@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.

aras-p added a commit that referenced this pull request Feb 24, 2013
* 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
aras-p added a commit that referenced this pull request Feb 24, 2013
* 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
@aras-p aras-p merged commit 3322bb0 into aras-p:master Feb 24, 2013
@aras-p
Copy link
Owner

aras-p commented Feb 24, 2013

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...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants