SWDEV-530767 ocltst GL test work with GL context on 2nd GPU (#324)
Change-Id: Ia3dbc661b3b9b1de71a632969707318f208131cd
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
592c25e936
Коммит
ef26fcdbd2
@@ -24,7 +24,7 @@
|
||||
#include <cstring>
|
||||
|
||||
void OCLGLCommon::open(unsigned int test, char *units, double &conversion,
|
||||
unsigned int deviceId) {
|
||||
unsigned int &deviceId) {
|
||||
// OpenCL Initialization
|
||||
OCLTestImp::open(test, units, conversion, deviceId);
|
||||
CHECK_RESULT((error_ != CL_SUCCESS), "Error opening test (%d)", error_);
|
||||
@@ -51,6 +51,8 @@ void OCLGLCommon::open(unsigned int test, char *units, double &conversion,
|
||||
CHECK_RESULT((retVal == CL_SUCCESS), "Error opening test (%d)", error_);
|
||||
|
||||
createCLContextFromGLContext(hGL_);
|
||||
// Device id may change to match the GL context. Return the id to caller
|
||||
deviceId = _deviceId;
|
||||
}
|
||||
|
||||
bool OCLGLCommon::IsGLEnabled(unsigned int test, char *units,
|
||||
|
||||
@@ -45,7 +45,7 @@ class OCLGLCommon : public OCLTestImp {
|
||||
// virtual interface //
|
||||
///////////////////////
|
||||
virtual void open(unsigned int test, char* units, double& conversion,
|
||||
unsigned int deviceId);
|
||||
unsigned int &deviceId);
|
||||
virtual unsigned int close(void);
|
||||
static void gluPerspective(double fovy, double aspect, double zNear,
|
||||
double zFar);
|
||||
|
||||
@@ -169,6 +169,21 @@ bool OCLGLCommon::checkAssociationDeviceWithGLContext(OCLGLHandle& hGL) {
|
||||
}
|
||||
}
|
||||
|
||||
// If the current device id does not work for CL GL interop,
|
||||
// fall back to other devices.
|
||||
if (!ret) {
|
||||
for (unsigned int i = 0; i < numDevices; i++) {
|
||||
for (unsigned int j = 0; j < deviceCount_; j++) {
|
||||
if (interopDevices[i] == devices_[j]) {
|
||||
// Found an OpenCL device work with current GL context.
|
||||
_deviceId = j;
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(interopDevices);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user