| 376 | return bv_variable_create_float(0.0f); |
| 377 | } |
| 378 | bv_variable lib_hlsl_f16tof32(bv_program* prog, u8 count, bv_variable* args) |
| 379 | { |
| 380 | /* f32tof16(genType) */ |
| 381 | if (count == 1) { |
| 382 | if (args[0].type == bv_type_object) { |
| 383 | bv_object* vec = bv_variable_get_object(args[0]); |
| 384 | |
| 385 | bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count); |
| 386 | bv_object* retObj = bv_variable_get_object(ret); |
| 387 | |
| 388 | glm::uvec4 val = sd::AsVector<4, unsigned int>(args[0]); |
| 389 | |
| 390 | glm::vec4 vecData(0); |
| 391 | for (u16 i = 0; i < 4; i++) |
| 392 | vecData[i] = glm::unpackHalf2x16(val[i]).x; |
| 393 | |
| 394 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 395 | retObj->prop[i] = bv_variable_create_float(vecData[i]); |
| 396 | |
| 397 | return ret; |
| 398 | } |
| 399 | // f32tof16(scalar) |
| 400 | else |
| 401 | return bv_variable_create_float(glm::unpackHalf2x16(bv_variable_get_uint(bv_variable_cast(bv_type_uint, args[0]))).x); |
| 402 | } |
| 403 | |
| 404 | return bv_variable_create_float(0.0f); |
| 405 | } |
| 406 | |
| 407 | /* vector */ |
| 408 | bv_variable lib_hlsl_dst(bv_program* prog, u8 count, bv_variable* args) |
nothing calls this directly
no test coverage detected