MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / UpdateImageTexture

Function UpdateImageTexture

tests/gpu/GPUUnitTest.cpp:217–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 }
216
217 void UpdateImageTexture(OCIO::OglAppRcPtr & app, OCIOGPUTestRcPtr & test)
218 {
219 // Note: User-specified custom values are padded out
220 // to the preferred size (g_winWidth x g_winHeight).
221
222 const unsigned predefinedNumEntries = g_winWidth * g_winHeight * g_components;
223
224 if (test->getCustomValues().m_inputValues.empty())
225 {
226 // It means to generate the input values.
227
228
229#if __APPLE__ && __aarch64__
230 // The Apple M1 chip handles differently the Nan and Inf processing introducing
231 // differences with CPU processing.
232 const bool testNaN = false;
233 const bool testInfinity = false;
234#else
235 const bool testNaN = test->getTestNaN();
236 const bool testInfinity = test->getTestInfinity();
237#endif
238
239 float min = 0.0f;
240 float max = 1.0f;
241 if(test->getTestWideRange())
242 {
243 test->getWideRangeInterval(min, max);
244 }
245 const float range = max - min;
246
247 OCIOGPUTest::CustomValues tmp;
248 tmp.m_originalInputValueSize = predefinedNumEntries;
249 tmp.m_inputValues = OCIOGPUTest::CustomValues::Values(predefinedNumEntries, min);
250
251 unsigned idx = 0;
252 unsigned numEntries = predefinedNumEntries;
253 const unsigned numTests = g_components * g_components;
254 if (testNaN)
255 {
256 const float qnan = std::numeric_limits<float>::quiet_NaN();
257 SetTestValue(&tmp.m_inputValues[0], qnan, g_components);
258 idx += numTests;
259 numEntries -= numTests;
260 }
261
262 if (testInfinity)
263 {
264 const float posinf = std::numeric_limits<float>::infinity();
265 SetTestValue(&tmp.m_inputValues[idx], posinf, g_components);
266 idx += numTests;
267 numEntries -= numTests;
268
269 const float neginf = -std::numeric_limits<float>::infinity();
270 SetTestValue(&tmp.m_inputValues[idx], neginf, g_components);
271 idx += numTests;
272 numEntries -= numTests;
273 }
274

Callers 1

mainFunction · 0.85

Calls 11

ValuesEnum · 0.85
SetTestValueFunction · 0.85
getTestNaNMethod · 0.80
getTestInfinityMethod · 0.80
getTestWideRangeMethod · 0.80
getWideRangeIntervalMethod · 0.80
setCustomValuesMethod · 0.80
updateImageMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected