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

Function lib_hlsl_isfinite

src/HLSLLibrary.cpp:199–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197 return bv_variable_create_float(0.0f);
198 }
199 bv_variable lib_hlsl_isfinite(bv_program* prog, u8 count, bv_variable* args)
200 {
201 /* isfinite(genType), isfinite(genDType) */
202 if (count == 1) {
203 if (args[0].type == bv_type_object) {
204 bv_object* vec = bv_variable_get_object(args[0]);
205
206 glm::vec4 val = sd::AsVector<4, float>(args[0]);
207 glm::bvec4 vecData = glm::not_(glm::isnan(val)) && glm::not_(glm::isinf(val));
208
209 bv_variable ret = Common::create_vec(prog, bv_type_uchar, vec->type->props.name_count);
210 bv_object* retObj = bv_variable_get_object(ret);
211
212 for (u16 i = 0; i < retObj->type->props.name_count; i++)
213 retObj->prop[i] = bv_variable_create_uchar(vecData[i]);
214
215 return ret;
216
217 }
218 // isfinite(float)
219 else {
220 float scalarData = bv_variable_get_float(bv_variable_cast(bv_type_float, args[0]));
221 return bv_variable_create_uchar(!glm::isnan(scalarData) && !glm::isinf(scalarData));
222 }
223 }
224
225 return bv_variable_create_uchar(0);
226 }
227 bv_variable lib_hlsl_fmod(bv_program* prog, u8 count, bv_variable* args)
228 {
229 /* mod(genType, genType), mod(genType, float), also for genDType */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected