Open deanm opened 8 years ago
This project is EOL but that bug is very embarrassing so I fixed it anyway.
Yeah, I assumed the project wasn't really maintained. But I think it's a really nice idea to be able to easily test shaders as C++ (even just for debugging sake). Know of any similar efforts?
The most similar library I found was https://github.com/gwiazdorrr/CxxSwizzle but last I checked (two years ago) it did not support other operators than the assignment operator on swizzled operands.
Due to the syntax of C++, it is impossible to parse all possible GLSL code as C++ code anyway, so this approach can't possibly yield a perfect solution, which is why I discontinued this project.
A more complete solution might be to use the Mesa 3D library which can do software OpenGL emulation and also has a glsl_compiler that outputs an AST.
The matrix * vector multiplication is incorrect, effectively treating the matrix as row major when it is column major.
For example
for (int j = 0; j < N; j++) sum += a[i][j] * b[j];
should befor (int j = 0; j < N; j++) sum += a[j][i] * b[j];
, etc.