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 <doug.walker@autodesk.com>

Signed-off-by: Doug Walker <doug.walker@autodesk.com>
(cherry picked from commit 8a93946)
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
  • Loading branch information
doug-walker authored and cedrik-fuoco-adsk committed Jan 5, 2023
1 parent dd43d66 commit f840905
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 @@ -1072,8 +1072,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 f840905

Please sign in to comment.