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

Function lib_common_floor

src/CommonLibrary.cpp:1411–1432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1409 return bv_variable_create_float(0.0f);
1410 }
1411 bv_variable lib_common_floor(bv_program* prog, u8 count, bv_variable* args)
1412 {
1413 /* floor(genType) */
1414 if (count == 1) {
1415 if (args[0].type == bv_type_object) { // floor(vec3), ...
1416 bv_object* vec = bv_variable_get_object(args[0]);
1417 glm::vec4 vecData = glm::floor(sd::AsVector<4, float>(args[0]));
1418
1419 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
1420 bv_object* retObj = bv_variable_get_object(ret);
1421
1422 for (u16 i = 0; i < retObj->type->props.name_count; i++)
1423 retObj->prop[i] = bv_variable_create_float(vecData[i]);
1424
1425 return ret;
1426 }
1427 else // floor(scalar)
1428 return bv_variable_create_float(glm::floor(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]))));
1429 }
1430
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

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected