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

Function lib_common_round

src/CommonLibrary.cpp:2041–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2039 return bv_variable_create_float(0.0f);
2040 }
2041 bv_variable lib_common_round(bv_program* prog, u8 count, bv_variable* args)
2042 {
2043 /* round(genType) */
2044 if (count == 1) {
2045 if (args[0].type == bv_type_object) {
2046 bv_object* vec = bv_variable_get_object(args[0]);
2047 glm::vec4 vecData = glm::round(sd::AsVector<4, float>(args[0]));
2048
2049 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
2050 bv_object* retObj = bv_variable_get_object(ret);
2051
2052 for (u16 i = 0; i < retObj->type->props.name_count; i++)
2053 retObj->prop[i] = bv_variable_create_float(vecData[i]);
2054
2055 return ret;
2056 }
2057 else // cos(scalar)
2058 return bv_variable_create_float(glm::round(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
2059 }
2060
2061 return bv_variable_create_float(0.0f);
2062 }
2063 bv_variable lib_common_sign(bv_program* prog, u8 count, bv_variable* args)
2064 {
2065 /* sign(genType), sign(genIType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected