From c8d7d1972d0393598dc8a70e0895b62edffc08ff Mon Sep 17 00:00:00 2001 From: Doug Walker Date: Thu, 27 Oct 2022 00:20:31 -0400 Subject: [PATCH] Fix atan2 argument order for HLSL Signed-off-by: Doug Walker --- src/OpenColorIO/GpuShaderUtils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OpenColorIO/GpuShaderUtils.cpp b/src/OpenColorIO/GpuShaderUtils.cpp index 89d6539848..83689d8ff1 100644 --- a/src/OpenColorIO/GpuShaderUtils.cpp +++ b/src/OpenColorIO/GpuShaderUtils.cpp @@ -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: