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

Function lib_common_log

src/CommonLibrary.cpp:1590–1611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1588 return bv_variable_create_uchar(0);
1589 }
1590 bv_variable lib_common_log(bv_program* prog, u8 count, bv_variable* args)
1591 {
1592 /* log(genType) */
1593 if (count == 1) {
1594 if (args[0].type == bv_type_object) { // log(vec3), ...
1595 bv_object* vec = bv_variable_get_object(args[0]);
1596 glm::vec4 vecData = glm::log(sd::AsVector<4, float>(args[0]));
1597
1598 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
1599 bv_object* retObj = bv_variable_get_object(ret);
1600
1601 for (u16 i = 0; i < retObj->type->props.name_count; i++)
1602 retObj->prop[i] = bv_variable_create_float(vecData[i]);
1603
1604 return ret;
1605 }
1606 else // log(scalar)
1607 return bv_variable_create_float(glm::log(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
1608 }
1609
1610 return bv_variable_create_float(0.0f);
1611 }
1612 bv_variable lib_common_log2(bv_program* prog, u8 count, bv_variable* args)
1613 {
1614 /* log2(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected