floating points */
| 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) */ |
nothing calls this directly
no test coverage detected