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 82ed0fde32
    Author: Chris Pavlina <pavlina.chris@gmail.com>
    Date:   Sun Aug 28 02:05:49 2016 -0400

    Fix shared data access in raytracer, tidy up render loop
This commit is contained in:
Chris Pavlina 2016-09-04 17:43:37 -04:00
parent 76f78bb48b
commit 9740d5e433
2 changed files with 5 additions and 4 deletions

View File

@ -28,6 +28,7 @@
*/ */
#include <GL/glew.h> #include <GL/glew.h>
#include <climits>
#include "c3d_render_raytracing.h" #include "c3d_render_raytracing.h"
#include "mortoncodes.h" #include "mortoncodes.h"
@ -352,15 +353,16 @@ void C3D_RENDER_RAYTRACING::rt_render_tracing( GLubyte *ptrPBO ,
REPORTER *aStatusTextReporter ) REPORTER *aStatusTextReporter )
{ {
m_isPreview = false; 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(); const unsigned startTime = GetRunningMicroSecs();
bool breakLoop = false; bool breakLoop = false;
int numBlocksRendered = 0; int numBlocksRendered = 0;
#pragma omp parallel for schedule(dynamic) shared(breakLoop) \ #pragma omp parallel for schedule(dynamic) shared(breakLoop) \
firstprivate(ptrPBO, nrBlocks, startTime) reduction(+:numBlocksRendered) default(none) 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) #pragma omp flush(breakLoop)

View File

@ -40,7 +40,6 @@
#include <plugins/3dapi/c3dmodel.h> #include <plugins/3dapi/c3dmodel.h>
#include <map> #include <map>
#include <cstddef>
/// Vector of materials /// Vector of materials
typedef std::vector< CBLINN_PHONG_MATERIAL > MODEL_MATERIALS; typedef std::vector< CBLINN_PHONG_MATERIAL > MODEL_MATERIALS;
@ -111,7 +110,7 @@ private:
unsigned long int m_stats_start_rendering_time; unsigned long int m_stats_start_rendering_time;
/// Save the number of blocks progress of the render /// Save the number of blocks progress of the render
size_t m_nrBlocksRenderProgress; long m_nrBlocksRenderProgress;
CPOSTSHADER_SSAO m_postshader_ssao; CPOSTSHADER_SSAO m_postshader_ssao;