| 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 |
no test coverage detected