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

Function lib_hlsl_clip

src/HLSLLibrary.cpp:73–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 return bv_variable_create_void();
72 }
73 bv_variable lib_hlsl_clip(bv_program* prog, u8 count, bv_variable* args)
74 {
75 bool shouldDiscard = false;
76
77 if (count == 1) {
78 if (args[0].type == bv_type_object) { // acosh(vec3), ...
79 bv_object* vec = bv_variable_get_object(args[0]);
80 glm::vec4 vecData = sd::AsVector<4, float>(args[0]); // acosh takes only float vectors
81
82 for (u16 i = 0; i < vec->type->props.name_count; i++)
83 shouldDiscard |= (vecData[i] < 0.0f);
84 }
85 else // acosh(scalar)
86 shouldDiscard = (bv_variable_get_float(bv_variable_cast(bv_type_float, args[0])) < 0.0f);
87 }
88
89 if (shouldDiscard)
90 ((sd::ShaderDebugger*)prog->user_data)->SetDiscarded(true);
91
92 return bv_variable_create_void();
93 }
94
95 /* math */
96 bv_variable lib_hlsl_saturate(bv_program* prog, u8 count, bv_variable* args)

Callers

nothing calls this directly

Calls 1

SetDiscardedMethod · 0.80

Tested by

no test coverage detected