mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Verify GL sharing based on luid from wglGetLuidINTEL function
Related-To: NEO-5016 Change-Id: I4409132ce000d6052c7f69a9b19c01389d51c2de Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
8260e7c5d9
commit
98c9e3f6ca
@ -40,6 +40,8 @@ CL_GL_RESOURCE_INFO textureInfoInput = {0};
|
||||
CL_GL_RESOURCE_INFO textureInfoOutput = {0};
|
||||
NEO::GLMockReturnedValues glMockReturnedValues = {0};
|
||||
GLboolean GLSetSharedOCLContextStateReturnedValue = 1u;
|
||||
bool glGetLuidFuncAvailable = true;
|
||||
int glGetLuidCalled = 0;
|
||||
|
||||
const unsigned char *WINAPI glGetString(unsigned int name) {
|
||||
if (name == GL_VENDOR)
|
||||
@ -129,6 +131,20 @@ GLDisplay WINAPI mockGLGetCurrentDisplay() {
|
||||
GLGetCurrentDisplayCalled++;
|
||||
return glMockReturnedValues.currentDisplay;
|
||||
};
|
||||
|
||||
LUID WINAPI wglGetLuidMock(GLContext glContext) {
|
||||
glGetLuidCalled++;
|
||||
LUID luid{};
|
||||
if (reinterpret_cast<GLContext>(1) == glContext) {
|
||||
luid.HighPart = 0x1d2e;
|
||||
luid.LowPart = 0x3f4a;
|
||||
} else if (reinterpret_cast<GLContext>(2) == glContext) {
|
||||
luid.HighPart = 0x5d2e;
|
||||
luid.LowPart = 0x3f4a;
|
||||
}
|
||||
return luid;
|
||||
};
|
||||
|
||||
PROC WINAPI wglGetProcAddress(LPCSTR name) {
|
||||
if (strcmp(name, "wglSetSharedOCLContextStateINTEL") == 0) {
|
||||
return reinterpret_cast<PROC>(*wglSetSharedOCLContextStateINTELMock);
|
||||
@ -163,6 +179,9 @@ PROC WINAPI wglGetProcAddress(LPCSTR name) {
|
||||
if (strcmp(name, "glGetStringi") == 0) {
|
||||
return reinterpret_cast<PROC>(*glGetStringiMock);
|
||||
}
|
||||
if (strcmp(name, "wglGetLuidINTEL") == 0 && glGetLuidFuncAvailable) {
|
||||
return reinterpret_cast<PROC>(wglGetLuidMock);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
HGLRC WINAPI wglGetCurrentContext() {
|
||||
@ -268,6 +287,17 @@ void resetParam(const char *name) {
|
||||
WGLCreateContextCalled = 0;
|
||||
WGLDeleteContextCalled = 0;
|
||||
WGLShareListsCalled = 0;
|
||||
glGetLuidCalled = 0;
|
||||
glGetLuidFuncAvailable = true;
|
||||
}
|
||||
if (strcmp(name, "glGetLuidCalled") == 0) {
|
||||
glGetLuidCalled = 0;
|
||||
}
|
||||
if (strcmp(name, "glGetLuidFuncAvailable") == 0) {
|
||||
glGetLuidFuncAvailable = true;
|
||||
}
|
||||
if (strcmp(name, "glGetLuidFuncNotAvailable") == 0) {
|
||||
glGetLuidFuncAvailable = false;
|
||||
}
|
||||
};
|
||||
int getParam(const char *name) {
|
||||
@ -319,6 +349,9 @@ int getParam(const char *name) {
|
||||
if (strcmp(name, "WGLShareListsCalled") == 0) {
|
||||
return WGLShareListsCalled;
|
||||
}
|
||||
if (strcmp(name, "glGetLuidCalled") == 0) {
|
||||
return glGetLuidCalled;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
CL_GL_BUFFER_INFO getBufferInfo() { return bufferInfoInput; };
|
||||
|
Reference in New Issue
Block a user