SWDEV-470698 - fix formatting, add format check workflow (#657)
이 커밋은 다음에 포함됨:
1574 파일이 변경됨
+162903
-199277
검색과 일치하는 파일 없음
@@ -90,12 +90,10 @@ bool OCLGLCommon::initializeGLContext(OCLGLHandle& hGL) {
|
||||
}
|
||||
}
|
||||
if (hGL->vInfo == NULL) {
|
||||
int dblBuf[] = {GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE,
|
||||
1, GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE,
|
||||
12, GLX_DOUBLEBUFFER, None};
|
||||
int dblBuf[] = {GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE,
|
||||
1, GLX_DEPTH_SIZE, 12, GLX_DOUBLEBUFFER, None};
|
||||
|
||||
hGL->vInfo =
|
||||
glXChooseVisual(hGL->display, DefaultScreen(hGL->display), dblBuf);
|
||||
hGL->vInfo = glXChooseVisual(hGL->display, DefaultScreen(hGL->display), dblBuf);
|
||||
if (hGL->vInfo == NULL) {
|
||||
printf("glXChooseVisual() failed\n");
|
||||
return false;
|
||||
@@ -110,14 +108,12 @@ bool OCLGLCommon::initializeGLContext(OCLGLHandle& hGL) {
|
||||
}
|
||||
|
||||
XSetWindowAttributes swa = {0};
|
||||
hGL->cmap = XCreateColormap(hGL->display,
|
||||
RootWindow(hGL->display, hGL->vInfo->screen),
|
||||
hGL->cmap = XCreateColormap(hGL->display, RootWindow(hGL->display, hGL->vInfo->screen),
|
||||
hGL->vInfo->visual, AllocNone);
|
||||
swa.colormap = hGL->cmap;
|
||||
hGL->window = XCreateWindow(
|
||||
hGL->display, RootWindow(hGL->display, hGL->vInfo->screen), 0, 0, 640,
|
||||
480, 0, hGL->vInfo->depth, InputOutput, hGL->vInfo->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &swa);
|
||||
hGL->window = XCreateWindow(hGL->display, RootWindow(hGL->display, hGL->vInfo->screen), 0, 0, 640,
|
||||
480, 0, hGL->vInfo->depth, InputOutput, hGL->vInfo->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &swa);
|
||||
|
||||
Bool glErr = glXMakeCurrent(hGL->display, hGL->window, hGL->context);
|
||||
if (False == glErr) {
|
||||
@@ -142,8 +138,8 @@ bool OCLGLCommon::checkAssociationDeviceWithGLContext(OCLGLHandle& hGL) {
|
||||
(cl_context_properties)hGL->display,
|
||||
0};
|
||||
|
||||
error_ = _wrapper->clGetGLContextInfoKHR(
|
||||
properties, CL_DEVICES_FOR_GL_CONTEXT_KHR, 0, NULL, &devicesSize);
|
||||
error_ = _wrapper->clGetGLContextInfoKHR(properties, CL_DEVICES_FOR_GL_CONTEXT_KHR, 0, NULL,
|
||||
&devicesSize);
|
||||
if (error_ != CL_SUCCESS) {
|
||||
printf("clGetGLContextInfoKHR failed (%d)\n", error_);
|
||||
return false;
|
||||
@@ -152,9 +148,8 @@ bool OCLGLCommon::checkAssociationDeviceWithGLContext(OCLGLHandle& hGL) {
|
||||
cl_uint numDevices = (cl_uint)devicesSize / sizeof(cl_device_id);
|
||||
cl_device_id* interopDevices = (cl_device_id*)malloc(devicesSize);
|
||||
|
||||
error_ =
|
||||
_wrapper->clGetGLContextInfoKHR(properties, CL_DEVICES_FOR_GL_CONTEXT_KHR,
|
||||
devicesSize, interopDevices, NULL);
|
||||
error_ = _wrapper->clGetGLContextInfoKHR(properties, CL_DEVICES_FOR_GL_CONTEXT_KHR, devicesSize,
|
||||
interopDevices, NULL);
|
||||
if (error_ != CL_SUCCESS) {
|
||||
printf("clGetGLContextInfoKHR failed (%d)\n", error_);
|
||||
free(interopDevices);
|
||||
@@ -200,8 +195,7 @@ void OCLGLCommon::createCLContextFromGLContext(OCLGLHandle& hGL) {
|
||||
// Release current command queue
|
||||
if (cmdQueues_[_deviceId]) {
|
||||
error_ = _wrapper->clReleaseCommandQueue(cmdQueues_[_deviceId]);
|
||||
CHECK_RESULT_NO_RETURN((error_ != CL_SUCCESS),
|
||||
"clReleaseCommandQueue() failed");
|
||||
CHECK_RESULT_NO_RETURN((error_ != CL_SUCCESS), "clReleaseCommandQueue() failed");
|
||||
}
|
||||
|
||||
// Release current context
|
||||
@@ -211,22 +205,18 @@ void OCLGLCommon::createCLContextFromGLContext(OCLGLHandle& hGL) {
|
||||
}
|
||||
|
||||
// Create new CL context from GL context
|
||||
context_ =
|
||||
clCreateContext(properties, 1, &devices_[_deviceId], NULL, NULL, &error_);
|
||||
context_ = clCreateContext(properties, 1, &devices_[_deviceId], NULL, NULL, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateContext() failed (%d)", error_);
|
||||
|
||||
// Create command queue for new context
|
||||
cmdQueues_[_deviceId] =
|
||||
_wrapper->clCreateCommandQueue(context_, devices_[_deviceId], 0, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateCommandQueue() failed (%d)",
|
||||
error_);
|
||||
cmdQueues_[_deviceId] = _wrapper->clCreateCommandQueue(context_, devices_[_deviceId], 0, &error_);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "clCreateCommandQueue() failed (%d)", error_);
|
||||
|
||||
// GLEW versions 1.13.0 and earlier do not fetch all GL function pointers
|
||||
// without glewExperimental set.
|
||||
glewExperimental = GL_TRUE;
|
||||
GLenum glErr = glewInit();
|
||||
CHECK_RESULT((glErr != GLEW_OK), "glewInit() failed: %s",
|
||||
glewGetErrorString(glErr));
|
||||
CHECK_RESULT((glErr != GLEW_OK), "glewInit() failed: %s", glewGetErrorString(glErr));
|
||||
}
|
||||
|
||||
void OCLGLCommon::makeCurrent(OCLGLHandle hGL) {
|
||||
@@ -240,8 +230,8 @@ void OCLGLCommon::makeCurrent(OCLGLHandle hGL) {
|
||||
}
|
||||
}
|
||||
|
||||
void OCLGLCommon::getCLContextPropertiesFromGLContext(
|
||||
const OCLGLHandle hGL, cl_context_properties properties[7]) {
|
||||
void OCLGLCommon::getCLContextPropertiesFromGLContext(const OCLGLHandle hGL,
|
||||
cl_context_properties properties[7]) {
|
||||
if (!properties) return;
|
||||
|
||||
properties[0] = CL_CONTEXT_PLATFORM;
|
||||
|
||||
새 이슈에서 참조
사용자 차단