Skip to content

Commit

Permalink
Fix atan2 argument order for HLSL (#1712)
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Walker <[email protected]>

Signed-off-by: Doug Walker <[email protected]>
  • Loading branch information
doug-walker authored Oct 28, 2022
1 parent 3ffcc3f commit 8a93946
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/OpenColorIO/GpuShaderUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,10 @@ std::string GpuShaderText::atan2(const std::string & y,
}
case GPU_LANGUAGE_HLSL_DX11:
{
// note: operand order is swapped in HLSL
kw << "atan2(" << x << ", " << y << ")";
// note: Various internet sources claim that the x & y arguments need to be
// swapped for HLSL (relative to GLSL). However, recent testing on Windows
// has revealed that the argument order needs to be the same as GLSL.
kw << "atan2(" << y << ", " << x << ")";
break;
}
case LANGUAGE_OSL_1:
Expand Down

0 comments on commit 8a93946

Please sign in to comment.