Skip to content

Commit 85bb5f9

Browse files
Several HLSLTranslator fixes
1 parent 6157c58 commit 85bb5f9

File tree

7 files changed

+280
-159
lines changed

7 files changed

+280
-159
lines changed

src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
#include <stdarg.h>
1919
#include <string.h>
20+
#include <vector>
21+
#include <algorithm>
22+
#include <string>
2023

2124
namespace M4
2225
{
@@ -184,6 +187,8 @@ bool GLSLGenerator::Generate(HLSLTree* tree, Target target, Version version, con
184187
m_outAttribPrefix = "rast_";
185188
}
186189

190+
m_tree->ReplaceUniformsAssignements();
191+
187192
HLSLRoot* root = m_tree->GetRoot();
188193
HLSLStatement* statement = root->statement;
189194

@@ -793,22 +798,19 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType*
793798
const HLSLType& type0 = functionCall->function->argument->type;
794799
const HLSLType& type1 = functionCall->function->argument->nextArgument->type;
795800

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))
800802
{
801-
m_writer.Write("%s((", prefix);
802-
OutputExpression(argument[1], &type1);
803-
m_writer.Write(")%s(", infix);
803+
m_writer.Write("dot((");
804804
OutputExpression(argument[0], &type0);
805+
m_writer.Write("),(");
806+
OutputExpression(argument[1], &type1);
805807
m_writer.Write("))");
806808
}
807809
else
808810
{
809-
m_writer.Write("%s((", prefix);
811+
m_writer.Write("((");
810812
OutputExpression(argument[0], &type0);
811-
m_writer.Write(")%s(", infix);
813+
m_writer.Write(")*(");
812814
OutputExpression(argument[1], &type1);
813815
m_writer.Write("))");
814816
}

0 commit comments

Comments
 (0)