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

Function lib_hlsl_asfloat

src/HLSLLibrary.cpp:328–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326 return bv_variable_create_void();
327 }
328 bv_variable lib_hlsl_asfloat(bv_program* prog, u8 count, bv_variable* args)
329 {
330 /* asfloat(genIType) */
331 if (count == 1) {
332 if (args[0].type == bv_type_object) {
333 bv_object* vec = bv_variable_get_object(args[0]);
334 glm::vec4 vecData = glm::intBitsToFloat(sd::AsVector<4, int>(args[0]));
335
336 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
337 bv_object* retObj = bv_variable_get_object(ret);
338
339 for (u16 i = 0; i < retObj->type->props.name_count; i++)
340 retObj->prop[i] = bv_variable_create_float(vecData[i]);
341
342 return ret;
343 }
344 else // asfloat(scalar)
345 return bv_variable_create_float(glm::intBitsToFloat(bv_variable_get_int(bv_variable_cast(bv_type_int, args[0]))));
346 }
347
348 return bv_variable_create_float(0.0f);
349 }
350 bv_variable lib_hlsl_f32tof16(bv_program* prog, u8 count, bv_variable* args)
351 {
352 /* f32tof16(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected