Skip to content

Commit 7050626

Browse files
yoyofrkblaschke
authored andcommitted
Add additional alternates for the mult() function with int as arguments
Required to propagate NaNs as SM3/DX9 does. Signed-off-by: Kai Blaschke <[email protected]>
1 parent eccdd26 commit 7050626

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

vendor/hlslparser/src/GLSLGenerator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ bool GLSLGenerator::Generate(HLSLTree* tree, Target target, Version version, con
426426

427427
if (m_options.flags & Flag_AlternateNanPropagation) {
428428
/* Implement alternate functions that propagate NaNs like shader model 3 and DX9. */
429+
m_writer.WriteLine(0, "float %s(int i_x, int i_y) { float x=float(i_x); float y=float(i_y); if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction);
430+
m_writer.WriteLine(0, "float %s(int i_x, float y) { float x=float(i_x); if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction);
431+
m_writer.WriteLine(0, "float %s(float x, int i_y) { float y=float(i_y); if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction);
429432
m_writer.WriteLine(0, "float %s(float x, float y) { if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction);
430433
m_writer.WriteLine(0, "vec2 %s(vec2 x, vec2 y) { return vec2(%s(x.x, y.x), %s(x.y, y.y)); }", m_altMultFunction, m_altMultFunction, m_altMultFunction);
431434
m_writer.WriteLine(0, "vec3 %s(vec3 x, vec3 y) { return vec3(%s(x.x, y.x), %s(x.y, y.y), %s(x.z, y.z)); }", m_altMultFunction, m_altMultFunction, m_altMultFunction, m_altMultFunction);

0 commit comments

Comments
 (0)