MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / lib_glsl_uaddCarry

Function lib_glsl_uaddCarry

src/GLSLLibrary.cpp:1461–1500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1459 return bv_variable_create_int(0);
1460 }
1461 bv_variable lib_glsl_uaddCarry(bv_program* prog, u8 count, bv_variable* args)
1462 {
1463 /* uaddCarry */
1464 if (count >= 3) {
1465 if (args[0].type == bv_type_object) {
1466 bv_object* x = bv_variable_get_object(args[0]);
1467 glm::uvec4 xData = sd::AsVector<4, unsigned int>(args[0]);
1468 glm::uvec4 yData = sd::AsVector<4, unsigned int>(args[1]);
1469
1470 glm::uvec4 carry;
1471 glm::uvec4 res = glm::uaddCarry(xData, yData, carry);
1472
1473 bv_variable* outCarry = bv_variable_get_pointer(args[2]);
1474 bv_object* outCarryObj = bv_variable_get_object(*outCarry);
1475 for (u16 i = 0; i < outCarryObj->type->props.name_count; i++)
1476 outCarryObj->prop[i] = bv_variable_create_uint(carry[i]);
1477
1478 bv_variable ret = Common::create_vec(prog, bv_type_uint, outCarryObj->type->props.name_count);
1479 bv_object* retObj = bv_variable_get_object(ret);
1480 for (u16 i = 0; i < retObj->type->props.name_count; i++)
1481 retObj->prop[i] = bv_variable_create_uint(res[i]);
1482
1483 return ret;
1484 }
1485 else {
1486 unsigned int x = bv_variable_get_uint(args[0]);
1487 unsigned int y = bv_variable_get_uint(args[1]);
1488
1489 unsigned int res = 0, carry = 0;
1490 res = glm::uaddCarry(x, y, carry);
1491
1492 bv_variable* outCarry = bv_variable_get_pointer(args[2]);
1493 bv_variable_set_uint(outCarry, carry);
1494
1495 return bv_variable_create_uint(res);
1496 }
1497 }
1498
1499 return bv_variable_create_uint(0);
1500 }
1501 bv_variable lib_glsl_umulExtended(bv_program* prog, u8 count, bv_variable* args)
1502 {
1503 /* umulExtended */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected