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

Function lib_hlsl_rcp

src/HLSLLibrary.cpp:153–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 return bv_variable_create_void();
152 }
153 bv_variable lib_hlsl_rcp(bv_program* prog, u8 count, bv_variable* args)
154 {
155 /* rcp(genType) */
156 if (count == 1) {
157 if (args[0].type == bv_type_object) { // ceil(vec3), ...
158 bv_object* vec = bv_variable_get_object(args[0]);
159 glm::vec4 vecData = glm::vec4(1.0f)/sd::AsVector<4, float>(args[0]);
160
161 bv_variable ret = Common::create_vec(prog, bv_type_float, vec->type->props.name_count);
162 bv_object* retObj = bv_variable_get_object(ret);
163
164 for (u16 i = 0; i < retObj->type->props.name_count; i++)
165 retObj->prop[i] = bv_variable_create_float(vecData[i]);
166
167 return ret;
168 }
169 else // rcp(scalar)
170 return bv_variable_create_float(1.0f / bv_variable_get_float(bv_variable_cast(bv_type_float, args[0])));
171 }
172
173 return bv_variable_create_float(0.0f);
174 }
175 bv_variable lib_hlsl_log10(bv_program* prog, u8 count, bv_variable* args)
176 {
177 /* rcp(genType) */

Callers

nothing calls this directly

Calls 1

create_vecFunction · 0.85

Tested by

no test coverage detected