|
17 | 17 |
|
18 | 18 | #include <stdarg.h> |
19 | 19 | #include <string.h> |
| 20 | +#include <vector> |
| 21 | +#include <algorithm> |
| 22 | +#include <string> |
20 | 23 |
|
21 | 24 | namespace M4 |
22 | 25 | { |
@@ -184,6 +187,8 @@ bool GLSLGenerator::Generate(HLSLTree* tree, Target target, Version version, con |
184 | 187 | m_outAttribPrefix = "rast_"; |
185 | 188 | } |
186 | 189 |
|
| 190 | + m_tree->ReplaceUniformsAssignements(); |
| 191 | + |
187 | 192 | HLSLRoot* root = m_tree->GetRoot(); |
188 | 193 | HLSLStatement* statement = root->statement; |
189 | 194 |
|
@@ -793,22 +798,19 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType* |
793 | 798 | const HLSLType& type0 = functionCall->function->argument->type; |
794 | 799 | const HLSLType& type1 = functionCall->function->argument->nextArgument->type; |
795 | 800 |
|
796 | | - const char* prefix = (m_options.flags & Flag_LowerMatrixMultiplication) ? m_matrixMulFunction : ""; |
797 | | - const char* infix = (m_options.flags & Flag_LowerMatrixMultiplication) ? "," : "*"; |
798 | | - |
799 | | - if (m_options.flags & Flag_PackMatrixRowMajor) |
| 801 | + if (IsVectorType(type0.baseType) && IsVectorType(type1.baseType)) |
800 | 802 | { |
801 | | - m_writer.Write("%s((", prefix); |
802 | | - OutputExpression(argument[1], &type1); |
803 | | - m_writer.Write(")%s(", infix); |
| 803 | + m_writer.Write("dot(("); |
804 | 804 | OutputExpression(argument[0], &type0); |
| 805 | + m_writer.Write("),("); |
| 806 | + OutputExpression(argument[1], &type1); |
805 | 807 | m_writer.Write("))"); |
806 | 808 | } |
807 | 809 | else |
808 | 810 | { |
809 | | - m_writer.Write("%s((", prefix); |
| 811 | + m_writer.Write("(("); |
810 | 812 | OutputExpression(argument[0], &type0); |
811 | | - m_writer.Write(")%s(", infix); |
| 813 | + m_writer.Write(")*("); |
812 | 814 | OutputExpression(argument[1], &type1); |
813 | 815 | m_writer.Write("))"); |
814 | 816 | } |
|
0 commit comments