Skip to content

Commit

Permalink
Fix warning around "#pragma omp simd" usage that is not available on …
Browse files Browse the repository at this point in the history
…Apple M1 Pro with Apple clang version 16.0.0 compiler:

[ 91%] Building CXX object modules/ar/CMakeFiles/visp_ar.dir/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp.o
.../modules/ar/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp:184:33: warning: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
  184 | void vpPanda3DGeometryRenderer::getRender(vpImage<vpRGBf> &normals, vpImage<float> &depth, const vpRect &bb, unsigned int h, unsigned w) const
      |                                 ^
1 warning generated.
  • Loading branch information
fspindle committed Nov 3, 2024
1 parent 83e0f5f commit 998ca20
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions modules/ar/src/panda3d-simulator/vpPanda3DGeometryRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,22 @@ void vpPanda3DGeometryRenderer::getRender(vpImage<vpRGBf> &normals, vpImage<floa
if (numComponents != 4) {
throw vpException(vpException::dimensionError, "Expected panda texture to have 4 components!");
}

int image_width = static_cast<int>(m_renderParameters.getImageWidth());
for (unsigned int i = 0; i < m_renderParameters.getImageHeight(); ++i) {
const float *const rowData = data - i * rowIncrement;
vpRGBf *normalRow = normals[top + i];
float *depthRow = depth[top + i];
#pragma omp simd
for (unsigned int j = 0; j < m_renderParameters.getImageWidth(); ++j) {
normalRow[left + j].R = (rowData[j * 4]);
normalRow[left + j].G = (rowData[j * 4 + 1]);
normalRow[left + j].B = (rowData[j * 4 + 2]);
depthRow[left + j] = (rowData[j * 4 + 3]);
#if defined(_OPENMP)
#pragma omp parallel for
#endif
for (int j = 0; j < image_width; ++j) {
int left_j = left + j;
int j_4 = j + 4;
normalRow[left_j].R = (rowData[j_4]);
normalRow[left_j].G = (rowData[j_4 + 1]);
normalRow[left_j].B = (rowData[j_4 + 2]);
depthRow[left_j] = (rowData[j_4 + 3]);
}
}
}
Expand Down

0 comments on commit 998ca20

Please sign in to comment.