2016-09-05 19:57 GMT+02:00 Fabian Maurer dark.shadow4@web.de:
On Friday, September 2, 2016 7:45:04 PM CEST you wrote:
I don't see a parser rule for function calls at the moment. Looking at my private branch, I have an additional VAR_IDENTIFIER '(' func_arguments ')' rule for the postfix_expr nonterminal.
In general, the parser should be in pretty decent shape, if missing some rules. Everything else (IR transformation / optimization, codegen) is just not there at the moment.
Somewhat related: the current IR probably isn't quite optimal. It's a tree IR, quite strongly inspired by the one from the current GLSL compiler in Mesa. At least two issues with it are that memory usage can get relatively high and some optimizations are difficult to do with it. Fortunately we don't need to do too much optimization since there is another compiler down the line (e.g. GLSL compiler in the OpenGL drivers) which should be able to cover up our shortcomings...
Thanks, I think I can work with that. Probably need to implement a few DX11 functions first if I want to test it though.
Also, I should probably write some tests. How would one go about that, just compile a few shaders and try if we can render them? Though I feel like it would be better to test the bytecode somehow to rule out errors in wined3d.
Have a look at the existing tests in d3dcompiler_43/tests/hlsl.c. There is room for improvement there (like adding more tests with interesting constructs e.g. loops) but those should be an okay starting point.