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

Function lib_common_log2

src/CommonLibrary.cpp:1612–1633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) */
1615 if (count == 1) {
1616 if (args[0].type == bv_type_object) { // exp2(vec3), ...
1617 bv_object* vec = bv_variable_get_object(args[0]);
1618 glm::vec4 vecData = glm::log2(sd::AsVector<4, float>(args[0]));
1619
1620 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
1621 bv_object* retObj = bv_variable_get_object(ret);
1622
1623 for (u16 i = 0; i < retObj->type->props.name_count; i++)
1624 retObj->prop[i] = bv_variable_create_float(vecData[i]);
1625
1626 return ret;
1627 }
1628 else // log2(scalar)
1629 return bv_variable_create_float(glm::log2(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
1630 }
1631
1632 return bv_variable_create_float(0.0f);
1633 }
1634 bv_variable lib_common_max(bv_program* prog, u8 count, bv_variable* args)
1635 {
1636 /* max(genType, genType), max(genType, float), also for genIType and genUType */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected