HLSL and GLSL wraping again

Started by
11 comments, last by ongamex92 8 years, 10 months ago

New week new update! I had a conjunctivitis and my eyes felt really tiered but I've managed to implement type deduction for the expressions. Now we can turn code form :


mat4f getm() {.....}
void f() {
    mat4f m;
    vec4f v;
    v = m * v * (getm() * v);
}

To :


void f() {
  mat4f m;
  vec4f v;
  v = mul(m, v) * (mul(getm(), v));
}

This works by traversing the tree in 3 passes:

Pass 1 - run thought all nodes and describe all the defined functions and variables.

Pass 2 - using the Information above deduce the type of every expression (a table that contains "vec multiplied by a mat is a vec", and so on)

Pass 3 - The code generation. m * v in HLSL is mul(m, v) while on GLSL is m * v

The code is still here https://github.com/ongamex/playground/tree/master/lang , but i don't recommend you to even download it.

Next week I will try to Improve the architecture and the readability of the code.
The ultimate goal of this project is not to provide a complete solution, but rather to be a simple project that has the essential functionality in it and to be extendable by anyone.

PS:

Maybe I should start a Journal or a new thread, or maybe this isn't interesting to anyone?
Or maybe I'm over-hyped.

Advertisement

Maybe I should start a Journal

You always should when you are excited about something.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Updates on the topic http://www.gamedev.net/blog/1921/entry-2261196-common-shading-language/

This topic is closed to new replies.

Advertisement