Show opencl program build errors on info tab, when compilation fails

This commit is contained in:
Simon Detheridge 2015-02-20 20:36:01 +00:00
parent c01f444d52
commit 582bd93dea
3 changed files with 11 additions and 1 deletions

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,7 +1243,10 @@ 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));
}
}
return false;

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

@ -1276,7 +1276,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;