From 9740d5e4338062fab517a79e11c2af83c5d40fcb Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sun, 4 Sep 2016 17:43:37 -0400 Subject: [PATCH] Fix nonstandard, unsigned OpenMP loop counter OpenMP does not yet permit unsigned loop counters. Most compilers seem to allow them anyway, but a few have been seen to complain. Mistake introduced in: commit 82ed0fde32d5e85b238e821af1e542574d8e9fe7 Author: Chris Pavlina Date: Sun Aug 28 02:05:49 2016 -0400 Fix shared data access in raytracer, tidy up render loop --- .../3d_render_raytracing/c3d_render_raytracing.cpp | 6 ++++-- .../3d_render_raytracing/c3d_render_raytracing.h | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp index c127584b7a..b3d5a05e01 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.cpp @@ -28,6 +28,7 @@ */ #include +#include #include "c3d_render_raytracing.h" #include "mortoncodes.h" @@ -352,15 +353,16 @@ void C3D_RENDER_RAYTRACING::rt_render_tracing( GLubyte *ptrPBO , REPORTER *aStatusTextReporter ) { m_isPreview = false; + wxASSERT( m_blockPositions.size() <= LONG_MAX ); - const size_t nrBlocks = m_blockPositions.size(); + const long nrBlocks = (long) m_blockPositions.size(); const unsigned startTime = GetRunningMicroSecs(); bool breakLoop = false; int numBlocksRendered = 0; #pragma omp parallel for schedule(dynamic) shared(breakLoop) \ firstprivate(ptrPBO, nrBlocks, startTime) reduction(+:numBlocksRendered) default(none) - for( size_t iBlock = 0; iBlock < nrBlocks; iBlock++ ) + for( long iBlock = 0; iBlock < nrBlocks; iBlock++ ) { #pragma omp flush(breakLoop) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.h b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.h index 05f7bc1eb7..d23e606820 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.h +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_raytracing.h @@ -40,7 +40,6 @@ #include #include -#include /// Vector of materials typedef std::vector< CBLINN_PHONG_MATERIAL > MODEL_MATERIALS; @@ -111,7 +110,7 @@ private: unsigned long int m_stats_start_rendering_time; /// Save the number of blocks progress of the render - size_t m_nrBlocksRenderProgress; + long m_nrBlocksRenderProgress; CPOSTSHADER_SSAO m_postshader_ssao;