Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

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 referenced this pull request from a commit
@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 authored
  2. fix CMakeList

    Maxime Coste authored
  3. remove unistd.h

    Maxime Coste authored
  4. Add support for non square matrices

    Maxime Coste authored
    * Non square matrices are glsl > 1.20
    * Use glsl matrix conversion functions (> 1.20 too)
    * various cleanups
  5. Add test for non-square matrix and vector promotion

    Maxime Coste authored
  6. handle upward vector promotion in TSymbolTableLevel::findCompatible

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

    Maxime Coste authored
  8. fix in type construction for swizzle

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

    Maxime Coste authored
    …oat.*, float.*)
  10. update tests results matrix non square

    Maxime Coste authored
  11. various swizzle and arrays fixes.

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

    Maxime Coste authored
  13. Add tests for tokenpasting and global initialization

    Maxime Coste authored
  14. Add support for more semantics

    Maxime Coste authored
  15. promote constant union to right type, plus fixes

    Maxime Coste authored
  16. fix EOpRightShiftAssign output, >>=, not ??=

    Maxime Coste authored
  17. Fix inverted left and right shift operators

    Maxime Coste authored
  18. add (shotgun style) coverage mask support

    Maxime Coste authored
  19. fix global-init test

    Maxime Coste authored
  20. add struct initialisation by scalar support

    Maxime Coste authored
  21. fix cast on function call

    Maxime Coste authored
  22. fix empty body if handling

    Maxime Coste authored
  23. add missing outES test files

    Maxime Coste authored
  24. enable some bitwise operations as supported features

    Maxime Coste authored
  25. binary not is ~, not -

    Maxime Coste authored
  26. yyerror takes a const char* instead of a char*

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