This commit is contained in:
mfeemster
2015-03-21 16:28:42 -07:00
10 changed files with 286 additions and 271 deletions

View File

@ -385,7 +385,7 @@ string FinalAccumOpenCLKernelCreator<T>::CreateGammaCorrectionFunctionString(boo
os <<
"\n"
" correctedChannels[rgbi] = (" << dataType << ")clamp(a, 0.0, 255.0);\n"
" correctedChannels[rgbi] = (" << dataType << ")clamp(a, (real_t)0.0, (real_t)255.0);\n"
" }\n"
"\n";

View File

@ -1130,6 +1130,7 @@ uint OpenCLWrapper::DeviceIndex() const { return m_DeviceIndex; }
size_t OpenCLWrapper::GlobalMemSize() const { return GetInfo<cl_ulong>(PlatformIndex(), DeviceIndex(), CL_DEVICE_GLOBAL_MEM_SIZE); }
uint OpenCLWrapper::LocalMemSize() const { return m_LocalMemSize; }
size_t OpenCLWrapper::MaxAllocSize() const { return GetInfo<cl_ulong>(PlatformIndex(), DeviceIndex(), CL_DEVICE_MAX_MEM_ALLOC_SIZE); }
std::vector<std::string> OpenCLWrapper::ProgramBuildErrors() const { return m_programBuildErrors; }
/// <summary>
/// Makes the even grid dims.
@ -1242,6 +1243,9 @@ bool OpenCLWrapper::CreateSPK(const string& name, const string& program, const s
if (CheckCL(err, "cl::Kernel()"))
return true;//Everything is ok.
} else {
for (std::vector<cl::Device>::iterator i = m_DeviceVec.begin(); i != m_DeviceVec.end(); ++ i )
m_programBuildErrors.push_back(spk.m_Program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(*i));
}
}

View File

@ -192,6 +192,7 @@ public:
uint LocalMemSize() const;
size_t GlobalMemSize() const;
size_t MaxAllocSize() const;
std::vector<std::string> ProgramBuildErrors() const;
static void MakeEvenGridDims(uint blockW, uint blockH, uint& gridW, uint& gridH);
@ -217,5 +218,6 @@ private:
std::vector<NamedBuffer> m_Buffers;
std::vector<NamedImage2D> m_Images;
std::vector<NamedImage2DGL> m_GLImages;
std::vector<std::string> m_programBuildErrors;
};
}

View File

@ -759,7 +759,12 @@ bool RendererCL<T>::BuildIterProgramForEmber(bool doAccum)
}
else
{
m_ErrorReport.push_back(string(loc) + "():\nBuilding the following program failed: \n" + m_IterKernel + "\n");
//m_ErrorReport.push_back(string(loc) + "():\nBuilding the following program failed: \n" + m_IterKernel + "\n");
std::vector<std::string> errors = m_Wrapper.ProgramBuildErrors();
m_ErrorReport.insert(m_ErrorReport.end(), errors.begin(), errors.end());
m_ErrorReport.push_back(loc);
return false;
}
@ -1297,7 +1302,11 @@ int RendererCL<T>::MakeAndGetFinalAccumProgram(T& alphaBase, T& alphaScale)
if (b)
kernelIndex = m_Wrapper.FindKernelIndex(finalAccumEntryPoint);//Try to find it again, it will be present if successfully built.
else
{
std::vector<std::string> errors = m_Wrapper.ProgramBuildErrors();
m_ErrorReport.insert(m_ErrorReport.end(), errors.begin(), errors.end());
m_ErrorReport.push_back(loc);
}
}
return kernelIndex;