| 1307 | } |
| 1308 | |
| 1309 | std::string GpuShaderText::atan2(const std::string & y, |
| 1310 | const std::string & x) const |
| 1311 | { |
| 1312 | std::ostringstream kw; |
| 1313 | switch(m_lang) |
| 1314 | { |
| 1315 | case GPU_LANGUAGE_CG: |
| 1316 | case GPU_LANGUAGE_GLSL_1_2: |
| 1317 | case GPU_LANGUAGE_GLSL_1_3: |
| 1318 | case GPU_LANGUAGE_GLSL_4_0: |
| 1319 | case GPU_LANGUAGE_GLSL_VK_4_6: |
| 1320 | case GPU_LANGUAGE_GLSL_ES_1_0: |
| 1321 | case GPU_LANGUAGE_GLSL_ES_3_0: |
| 1322 | { |
| 1323 | // note: "atan" not "atan2" |
| 1324 | kw << "atan(" << y << ", " << x << ")"; |
| 1325 | break; |
| 1326 | } |
| 1327 | case GPU_LANGUAGE_HLSL_SM_5_0: |
| 1328 | { |
| 1329 | // note: Various internet sources claim that the x & y arguments need to be |
| 1330 | // swapped for HLSL (relative to GLSL). However, recent testing on Windows |
| 1331 | // has revealed that the argument order needs to be the same as GLSL. |
| 1332 | kw << "atan2(" << y << ", " << x << ")"; |
| 1333 | break; |
| 1334 | } |
| 1335 | case LANGUAGE_OSL_1: |
| 1336 | case GPU_LANGUAGE_MSL_2_0: |
| 1337 | { |
| 1338 | kw << "atan2(" << y << ", " << x << ")"; |
| 1339 | break; |
| 1340 | } |
| 1341 | |
| 1342 | default: |
| 1343 | { |
| 1344 | throw Exception("Unknown GPU shader language."); |
| 1345 | } |
| 1346 | } |
| 1347 | return kw.str(); |
| 1348 | } |
| 1349 | |
| 1350 | std::string GpuShaderText::sign(const std::string & v) const |
| 1351 | { |
no outgoing calls
no test coverage detected