pull/26281/head
kallaballa 1 month ago
parent dceeb47cd3
commit 885bbc643f
  1. 22
      modules/core/src/opengl.cpp

@ -1684,15 +1684,15 @@ Context& initializeContextFromGL()
if (status != CL_SUCCESS) if (status != CL_SUCCESS)
continue; continue;
std::string stdDevString(extensions); std::string devString(extensions);
free(extensions); free(extensions);
size_t szOldPos = 0; size_t oldPos = 0;
size_t szSpacePos = stdDevString.find(' ', szOldPos); // extensions string is space delimited size_t spacePos = devString.find(' ', oldPos); // extensions string is space delimited
while (szSpacePos != stdDevString.npos) { while (spacePos != devString.npos) {
if (strcmp(GL_SHARING_EXTENSION, if (strcmp(GL_SHARING_EXTENSION,
stdDevString.substr(szOldPos, szSpacePos - szOldPos).c_str()) devString.substr(oldPos, spacePos - oldPos).c_str())
== 0) { == 0) {
// Device supports context sharing with OpenGL // Device supports context sharing with OpenGL
devUsed = i; devUsed = i;
@ -1700,9 +1700,9 @@ Context& initializeContextFromGL()
break; break;
} }
do { do {
szOldPos = szSpacePos + 1; oldPos = spacePos + 1;
szSpacePos = stdDevString.find(' ', szOldPos); spacePos = devString.find(' ', oldPos);
} while (szSpacePos == szOldPos); } while (spacePos == oldPos);
} }
} }
} }
@ -1713,11 +1713,11 @@ Context& initializeContextFromGL()
// Define OS-specific context properties and create the OpenCL context // Define OS-specific context properties and create the OpenCL context
#if defined (__APPLE__) #if defined (__APPLE__)
CGLContextObj kCGLContext = CGLGetCurrentContext(); CGLContextObj cglContext = CGLGetCurrentContext();
CGLShareGroupObj kCGLShareGroup = CGLGetShareGroup(kCGLContext); CGLShareGroupObj cglShareGroup = CGLGetShareGroup(cglContext);
cl_context_properties props[] = cl_context_properties props[] =
{ {
CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)kCGLShareGroup, CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)cglShareGroup,
0 0
}; };
context = clCreateContext(props, 0,0, NULL, NULL, &ciErrNum); context = clCreateContext(props, 0,0, NULL, NULL, &ciErrNum);

Loading…
Cancel
Save