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

Function lib_hlsl_asint

src/HLSLLibrary.cpp:270–298  ·  view source on GitHub ↗

floating points */

Source from the content-addressed store, hash-verified

268
269 /* floating points */
270 bv_variable lib_hlsl_asint(bv_program* prog, u8 count, bv_variable* args)
271 {
272 /* asint(genType) */
273 if (count == 1) {
274 if (args[0].type == bv_type_object) {
275 bv_object* vec = bv_variable_get_object(args[0]);
276
277 bv_variable ret = Common::create_vec(prog, bv_type_int, vec->type->props.name_count);
278 bv_object* retObj = bv_variable_get_object(ret);
279
280 glm::ivec4 vecData(0);
281 if (vec->prop->type == bv_type_float)
282 vecData = glm::floatBitsToInt(sd::AsVector<4, float>(args[0]));
283 else vecData = sd::AsVector<4, int>(args[0]);
284
285 for (u16 i = 0; i < retObj->type->props.name_count; i++)
286 retObj->prop[i] = bv_variable_create_int(vecData[i]);
287
288 return ret;
289 }
290 // asint(scalar)
291 else if (args[0].type == bv_type_float)
292 return bv_variable_create_int(glm::floatBitsToInt(bv_variable_get_float(args[0])));
293 else
294 return bv_variable_cast(bv_type_int, args[0]);
295 }
296
297 return bv_variable_create_float(0.0f);
298 }
299 bv_variable lib_hlsl_asuint(bv_program* prog, u8 count, bv_variable* args)
300 {
301 /* asuint(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected