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

Function lib_hlsl_asuint

src/HLSLLibrary.cpp:299–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) */
302 if (count == 1) {
303 if (args[0].type == bv_type_object) {
304 bv_object* vec = bv_variable_get_object(args[0]);
305
306 bv_variable ret = Common::create_vec(prog, bv_type_uint, vec->type->props.name_count);
307 bv_object* retObj = bv_variable_get_object(ret);
308
309 glm::uvec4 vecData(0);
310 if (vec->prop->type == bv_type_float)
311 vecData = glm::floatBitsToUint(sd::AsVector<4, float>(args[0]));
312 else vecData = sd::AsVector<4, unsigned int>(args[0]);
313
314 for (u16 i = 0; i < retObj->type->props.name_count; i++)
315 retObj->prop[i] = bv_variable_create_uint(vecData[i]);
316
317 return ret;
318 }
319 // asuint(scalar)
320 else if (args[0].type == bv_type_float)
321 return bv_variable_create_uint(glm::floatBitsToUint(bv_variable_get_float(args[0])));
322 else
323 return bv_variable_cast(bv_type_uint, args[0]);
324 }
325
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) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected