Skip to content

Loading…

Fixes ported from bitbucket #16

Merged
merged 27 commits into from

3 participants

@mawww

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 some commits
Maxime Coste hlsl2glsltest: add glut fallback version 2ab8932
Maxime Coste fix CMakeList f07f47e
Maxime Coste remove unistd.h 7bb8115
Maxime Coste Add support for non square matrices
* Non square matrices are glsl > 1.20
* Use glsl matrix conversion functions (> 1.20 too)
* various cleanups
d810559
Maxime Coste Fix vector upward promotion for single argument functions 24e11dd
Maxime Coste Add test for non-square matrix and vector promotion 3c7d5a9
Maxime Coste handle upward vector promotion in TSymbolTableLevel::findCompatible
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
46f390e
Maxime Coste Add overloading tests 0ecf0b0
Maxime Coste fix in type construction for swizzle 32fa4dd
Maxime Coste Fix bad order in HLSL matrix rows/columns, add definitions for mul(fl…
…oat.*, float.*)
3d63b9e
Maxime Coste update tests results matrix non square 09bd6f0
Maxime Coste various swizzle and arrays fixes.
 1..xxxx and array[float(1)] are now supported
44bcd46
Maxime Coste add execute permission to bison and flex 6369b03
Maxime Coste Add tests for tokenpasting and global initialization 26acd8f
Maxime Coste Add support for more semantics 8886350
Maxime Coste promote constant union to right type, plus fixes 21b7fe4
Maxime Coste fix EOpRightShiftAssign output, >>=, not ??= 550923c
Maxime Coste Fix inverted left and right shift operators 7f7d4b6
Maxime Coste add (shotgun style) coverage mask support 82ad870
Maxime Coste fix global-init test 53a8fdb
Maxime Coste add struct initialisation by scalar support 8c28971
Maxime Coste fix cast on function call 19fabb1
Maxime Coste fix empty body if handling 53d42ed
Maxime Coste add missing outES test files 90b325b
Maxime Coste enable some bitwise operations as supported features 0a02b37
Maxime Coste binary not is ~, not - 1d82640
Maxime Coste yyerror takes a const char* instead of a char* 3322bb0
@juj

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

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
Owner

@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

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

@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

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

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

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

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
Owner

@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 aras-p added a commit that referenced this pull request
@aras-p Modified merge of pull request #16 from mawww-master:
* 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
09889de
@aras-p aras-p merged commit 3322bb0 into aras-p:master
@aras-p
Owner

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
Commits on Dec 7, 2012
  1. hlsl2glsltest: add glut fallback version

    Maxime Coste committed
  2. fix CMakeList

    Maxime Coste committed
  3. remove unistd.h

    Maxime Coste committed
  4. Add support for non square matrices

    Maxime Coste committed
    * Non square matrices are glsl > 1.20
    * Use glsl matrix conversion functions (> 1.20 too)
    * various cleanups
  5. Fix vector upward promotion for single argument functions

    Maxime Coste committed
  6. Add test for non-square matrix and vector promotion

    Maxime Coste committed
  7. handle upward vector promotion in TSymbolTableLevel::findCompatible

    Maxime Coste committed
    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
  8. Add overloading tests

    Maxime Coste committed
  9. fix in type construction for swizzle

    Maxime Coste committed
  10. Fix bad order in HLSL matrix rows/columns, add definitions for mul(fl…

    Maxime Coste committed
    …oat.*, float.*)
  11. update tests results matrix non square

    Maxime Coste committed
  12. various swizzle and arrays fixes.

    Maxime Coste committed
     1..xxxx and array[float(1)] are now supported
  13. add execute permission to bison and flex

    Maxime Coste committed
  14. Add tests for tokenpasting and global initialization

    Maxime Coste committed
  15. Add support for more semantics

    Maxime Coste committed
  16. promote constant union to right type, plus fixes

    Maxime Coste committed
  17. fix EOpRightShiftAssign output, >>=, not ??=

    Maxime Coste committed
  18. Fix inverted left and right shift operators

    Maxime Coste committed
  19. add (shotgun style) coverage mask support

    Maxime Coste committed
  20. fix global-init test

    Maxime Coste committed
  21. add struct initialisation by scalar support

    Maxime Coste committed
  22. fix cast on function call

    Maxime Coste committed
  23. fix empty body if handling

    Maxime Coste committed
  24. add missing outES test files

    Maxime Coste committed
  25. enable some bitwise operations as supported features

    Maxime Coste committed
  26. binary not is ~, not -

    Maxime Coste committed
  27. yyerror takes a const char* instead of a char*

    Maxime Coste committed
Something went wrong with that request. Please try again.