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

Function lib_common_fma

src/CommonLibrary.cpp:1433–1468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1431 return bv_variable_create_float(0.0f);
1432 }
1433 bv_variable lib_common_fma(bv_program* prog, u8 count, bv_variable* args)
1434 {
1435 // a * b + c
1436 /* fma(genType, genType, genType), fma(genDType, genDType, genDType) */
1437 if (count == 3) {
1438 if (args[0].type == bv_type_object) {
1439 bv_object* vec = bv_variable_get_object(args[0]);
1440
1441 glm::vec4 a = sd::AsVector<4, float>(args[0]);
1442 glm::vec4 b = sd::AsVector<4, float>(args[1]);
1443 glm::vec4 c = sd::AsVector<4, float>(args[2]);
1444
1445 glm::vec4 vecData = glm::fma(a, b, c);
1446
1447 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
1448 bv_object* retObj = bv_variable_get_object(ret);
1449
1450 for (u16 i = 0; i < retObj->type->props.name_count; i++)
1451 retObj->prop[i] = bv_variable_create_float(vecData[i]);
1452
1453 return ret;
1454
1455 }
1456
1457 // fma(float, float, float)
1458 else {
1459 float a = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]));
1460 float b = bv_variable_get_float(bv_variable_cast(bv_type_float, args[1]));
1461 float c = bv_variable_get_float(bv_variable_cast(bv_type_float, args[2]));
1462
1463 return bv_variable_create_float(glm::fma(a, b, c));
1464 }
1465 }
1466
1467 return bv_variable_create_float(0.0f); // floor() must have 1 argument!
1468 }
1469 bv_variable lib_common_fract(bv_program* prog, u8 count, bv_variable* args)
1470 {
1471 /* fract(genType), fract(genDType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected