--Code changes

-Convert all enums to class enum to be consistent with C++11 style.
 -Convert some if/else statements in filter classes to case statements.
 -Add overloaded stream operators to print various enums.
This commit is contained in:
mfeemster
2015-12-31 16:00:36 -08:00
parent 1dc363d190
commit c8e2355ec2
27 changed files with 1081 additions and 925 deletions

View File

@ -455,7 +455,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
//Basic texture index interoplation does not produce identical results
//to the CPU. So the code here must explicitly do the same thing and not
//rely on the GPU texture coordinate lookup.
if (ember.m_PaletteMode == PALETTE_LINEAR)
if (ember.m_PaletteMode == ePaletteMode::PALETTE_LINEAR)
{
os <<
" real_t colorIndexFrac;\n"
@ -484,7 +484,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
" palColor2 = read_imagef(palette, paletteSampler, iPaletteCoord);\n"
" palColor1 = (palColor1 * (1.0f - (float)colorIndexFrac)) + (palColor2 * (float)colorIndexFrac);\n";//The 1.0f here *must* have the 'f' suffix at the end to compile.
}
else if (ember.m_PaletteMode == PALETTE_STEP)
else if (ember.m_PaletteMode == ePaletteMode::PALETTE_STEP)
{
os <<
" iPaletteCoord.x = (int)(secondPoint.m_ColorX * COLORMAP_LENGTH);\n"
@ -922,9 +922,9 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
if (projBits)
{
if (projBits & PROJBITS_BLUR)
if (projBits & size_t(eProjBits::PROJBITS_BLUR))
{
if (projBits & PROJBITS_YAW)
if (projBits & size_t(eProjBits::PROJBITS_YAW))
{
os <<
" real_t dsin, dcos;\n"
@ -967,9 +967,9 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
" secondPoint.m_Z -= ember->m_CamZPos;\n";
}
}
else if ((projBits & PROJBITS_PITCH) || (projBits & PROJBITS_YAW))
else if ((projBits & size_t(eProjBits::PROJBITS_PITCH)) || (projBits & size_t(eProjBits::PROJBITS_YAW)))
{
if (projBits & PROJBITS_YAW)
if (projBits & size_t(eProjBits::PROJBITS_YAW))
{
os <<
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"

View File

@ -769,14 +769,14 @@ eRenderStatus RendererCL<T, bucketT>::GaussianDensityFilter()
template <typename T, typename bucketT>
eRenderStatus RendererCL<T, bucketT>::AccumulatorToFinalImage(byte* pixels, size_t finalOffset)
{
eRenderStatus status = RunFinalAccum();
auto status = RunFinalAccum();
if (status == RENDER_OK && pixels && !m_Devices.empty() && !m_Devices[0]->m_Wrapper.Shared())
if (status == eRenderStatus::RENDER_OK && pixels && !m_Devices.empty() && !m_Devices[0]->m_Wrapper.Shared())
{
pixels += finalOffset;
if (!ReadFinal(pixels))
status = RENDER_ERROR;
status = eRenderStatus::RENDER_ERROR;
}
return status;
@ -853,7 +853,7 @@ EmberStats RendererCL<T, bucketT>::Iterate(size_t iterCount, size_t temporalSamp
{
m_IterTimer.Tic();//Tic() here to avoid including build time in iter time measurement.
if (m_LastIter == 0 && m_ProcessAction != KEEP_ITERATING)//Only reset the call count on the beginning of a new render. Do not reset on KEEP_ITERATING.
if (m_LastIter == 0 && m_ProcessAction != eProcessAction::KEEP_ITERATING)//Only reset the call count on the beginning of a new render. Do not reset on KEEP_ITERATING.
for (auto& dev : m_Devices)
dev->m_Calls = 0;
@ -1166,7 +1166,7 @@ eRenderStatus RendererCL<T, bucketT>::RunLogScaleFilter()
m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 100.0, 1, 0.0);
}
return b ? RENDER_OK : RENDER_ERROR;
return b ? eRenderStatus::RENDER_OK : eRenderStatus::RENDER_ERROR;
}
/// <summary>
@ -1288,7 +1288,7 @@ eRenderStatus RendererCL<T, bucketT>::RunDensityFilter()
AddToReport(loc);
}
return m_Abort ? RENDER_ABORT : (b ? RENDER_OK : RENDER_ERROR);
return m_Abort ? eRenderStatus::RENDER_ABORT : (b ? eRenderStatus::RENDER_OK : eRenderStatus::RENDER_ERROR);
}
/// <summary>
@ -1389,7 +1389,7 @@ eRenderStatus RendererCL<T, bucketT>::RunFinalAccum()
AddToReport(loc);
}
return b ? RENDER_OK : RENDER_ERROR;
return b ? eRenderStatus::RENDER_OK : eRenderStatus::RENDER_ERROR;
}
/// <summary>