MCPcopy Create free account
hub / github.com/ValveSoftware/steam-audio / OpenCLProgram

Method OpenCLProgram

core/src/core/opencl_kernel.cpp:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29// todo: build logs
30
31OpenCLProgram::OpenCLProgram(const OpenCLDevice& openCL,
32 const char* source)
33{
34 auto status = CL_SUCCESS;
35 mProgram = clCreateProgramWithSource(openCL.context(), 1, &source, nullptr, &status);
36 if (status != CL_SUCCESS)
37 throw Exception(Status::Initialization);
38
39 auto device = openCL.device();
40 status = clBuildProgram(mProgram, 1, &device, nullptr, nullptr, nullptr);
41 if (status != CL_SUCCESS)
42 {
43 size_t buildLogSize = 0;
44 clGetProgramBuildInfo(mProgram, openCL.device(), CL_PROGRAM_BUILD_LOG, buildLogSize, nullptr, &buildLogSize);
45
46 vector<char> buildLog(buildLogSize);
47 clGetProgramBuildInfo(mProgram, openCL.device(), CL_PROGRAM_BUILD_LOG, buildLogSize, buildLog.data(), nullptr);
48
49 gLog().message(MessageSeverity::Error, "OpenCL compile failed:\n\n%s", buildLog.data());
50
51 throw Exception(Status::Initialization);
52 }
53}
54
55OpenCLProgram::~OpenCLProgram()
56{

Callers

nothing calls this directly

Calls 5

ExceptionClass · 0.85
messageMethod · 0.80
contextMethod · 0.45
deviceMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected