Remove the usage of openmp in stk, see #2810

This commit is contained in:
Benau 2017-03-16 08:42:53 +08:00
parent 0f1e0f8f4d
commit cc2c2c6f33
3 changed files with 7 additions and 37 deletions

View File

@ -204,13 +204,6 @@ if(USE_FRIBIDI)
endif() endif()
endif() endif()
# OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
# OpenGL # OpenGL
if(NOT USE_GLES2 AND NOT SERVER_ONLY) if(NOT USE_GLES2 AND NOT SERVER_ONLY)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
@ -453,10 +446,6 @@ if(MINGW)
if(LIBSTDCPP) if(LIBSTDCPP)
file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/) file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
endif() endif()
find_library(LIBOPENMP NAMES "libgomp-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
if(LIBOPENMP)
file(COPY ${LIBOPENMP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
endif()
find_library(LIBPTHREAD NAMES "winpthread-1.dll" "libwinpthread-1.dll" "pthreadGC2.dll" PATHS ${CMAKE_FIND_ROOT_PATH}) find_library(LIBPTHREAD NAMES "winpthread-1.dll" "libwinpthread-1.dll" "pthreadGC2.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
if(LIBPTHREAD) if(LIBPTHREAD)
file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/) file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/)

View File

@ -514,7 +514,6 @@ void SFXManager::loadSfx()
array[i++] = buffer; array[i++] = buffer;
} }
#pragma omp parallel for private(i)
for (i = 0; i < max; i++) for (i = 0; i < max; i++)
{ {
array[i]->load(); array[i]->load();

View File

@ -688,38 +688,20 @@ void DrawCalls::prepareDrawCalls( ShadowMatrices& shadow_matrices,
return; return;
#if !defined(USE_GLES2) #if !defined(USE_GLES2)
int enableOpenMP = 0;
if (CVS->supportsAsyncInstanceUpload())
enableOpenMP = 1;
PROFILER_PUSH_CPU_MARKER("- Draw Command upload", 0xFF, 0x0, 0xFF); PROFILER_PUSH_CPU_MARKER("- Draw Command upload", 0xFF, 0x0, 0xFF);
m_solid_cmd_buffer->fill(m_solid_pass_mesh);
m_glow_cmd_buffer->fill(&m_glow_pass_mesh);
#pragma omp parallel sections if(enableOpenMP) irr_driver->setPhase(SHADOW_PASS);
m_shadow_cmd_buffer->fill(m_shadow_pass_mesh);
if (!shadow_matrices.isRSMMapAvail())
{ {
#pragma omp section m_reflective_shadow_map_cmd_buffer->fill(m_reflective_shadow_map_mesh);
{
m_solid_cmd_buffer->fill(m_solid_pass_mesh);
}
#pragma omp section
{
m_glow_cmd_buffer->fill(&m_glow_pass_mesh);
}
#pragma omp section
{
irr_driver->setPhase(SHADOW_PASS);
m_shadow_cmd_buffer->fill(m_shadow_pass_mesh);
}
#pragma omp section
if (!shadow_matrices.isRSMMapAvail())
{
m_reflective_shadow_map_cmd_buffer->fill(m_reflective_shadow_map_mesh);
}
} }
PROFILER_POP_CPU_MARKER(); PROFILER_POP_CPU_MARKER();
solid_poly_count = m_solid_cmd_buffer->getPolyCount(); solid_poly_count = m_solid_cmd_buffer->getPolyCount();
shadow_poly_count = m_shadow_cmd_buffer->getPolyCount(); shadow_poly_count = m_shadow_cmd_buffer->getPolyCount();
if (CVS->supportsAsyncInstanceUpload()) if (CVS->supportsAsyncInstanceUpload())
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
#endif // !defined(USE_GLES2) #endif // !defined(USE_GLES2)