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

Function lib_hlsl_sincos

src/HLSLLibrary.cpp:118–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 return bv_variable_create_float(0.0f);
117 }
118 bv_variable lib_hlsl_sincos(bv_program* prog, u8 count, bv_variable* args)
119 {
120 /* sincos */
121 if (count >= 3) {
122 if (args[0].type == bv_type_object) {
123 bv_object* x = bv_variable_get_object(args[0]);
124 glm::vec4 xData = sd::AsVector<4, float>(args[0]);
125
126 glm::vec4 sinRes = glm::sin(xData);
127 glm::vec4 cosRes = glm::cos(xData);
128
129 bv_variable* outSin = bv_variable_get_pointer(args[1]);
130 bv_object* outSinObj = bv_variable_get_object(*outSin);
131 for (u16 i = 0; i < outSinObj->type->props.name_count; i++)
132 outSinObj->prop[i] = bv_variable_create_float(sinRes[i]);
133
134 bv_variable* outCos = bv_variable_get_pointer(args[2]);
135 bv_object* outCosObj = bv_variable_get_object(*outCos);
136 for (u16 i = 0; i < outCosObj->type->props.name_count; i++)
137 outCosObj->prop[i] = bv_variable_create_float(cosRes[i]);
138 }
139 else {
140 float x = bv_variable_get_float(args[0]);
141 float sinRes = glm::sin(x), cosRes = glm::cos(x);
142
143 bv_variable* outSin = bv_variable_get_pointer(args[1]);
144 bv_variable_set_float(outSin, sinRes);
145
146 bv_variable* outCos = bv_variable_get_pointer(args[2]);
147 bv_variable_set_float(outCos, cosRes);
148 }
149 }
150
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) */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected