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

Function lib_common_step

src/CommonLibrary.cpp:2213–2268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2211 return bv_variable_create_float(0.0f);
2212 }
2213 bv_variable lib_common_step(bv_program* prog, u8 count, bv_variable* args)
2214 {
2215 /* step(genType, genType), step(float, genType) */
2216 if (count == 2) {
2217 if (args[0].type == bv_type_object) {
2218 bv_object* vec = bv_variable_get_object(args[0]);
2219
2220 glm::vec4 edge = sd::AsVector<4, float>(args[0]);
2221 glm::vec4 x(0.0f);
2222
2223 // get x
2224 if (args[1].type == bv_type_object)
2225 x = sd::AsVector<4, float>(args[1]);
2226 else
2227 x = glm::vec4(bv_variable_get_float(bv_variable_cast(bv_type_float, args[1])));
2228
2229 glm::vec4 vecData = glm::step(edge, x);
2230
2231 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
2232 bv_object* retObj = bv_variable_get_object(ret);
2233
2234 for (u16 i = 0; i < retObj->type->props.name_count; i++)
2235 retObj->prop[i] = bv_variable_create_float(vecData[i]);
2236
2237 return ret;
2238 }
2239
2240 // step(float, float)
2241 else if (args[0].type == bv_type_float) {
2242 glm::vec4 edge(bv_variable_get_float(bv_variable_cast(bv_type_float, args[0])));
2243
2244 // get x
2245 if (args[1].type == bv_type_object) {
2246 glm::vec4 x = sd::AsVector<4, float>(args[1]);
2247 bv_object* vec = bv_variable_get_object(args[1]);
2248
2249 glm::vec4 retData = glm::step(edge, x);
2250
2251 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
2252 bv_object* retObj = bv_variable_get_object(ret);
2253
2254 for (u16 i = 0; i < retObj->type->props.name_count; i++)
2255 retObj->prop[i] = bv_variable_create_float(retData[i]);
2256
2257 return ret;
2258 }
2259 else
2260 return bv_variable_create_float(
2261 glm::step(edge.x, bv_variable_get_float(bv_variable_cast(bv_type_float, args[1])))
2262 );
2263 }
2264
2265 }
2266
2267 return bv_variable_create_float(0.0f);
2268 }
2269 bv_variable lib_common_trunc(bv_program* prog, u8 count, bv_variable* args)
2270 {

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected