11/*
2- * Copyright (C) 2018 Intel Corporation
2+ * Copyright (C) 2018-2019 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
99#include " unit_tests/mocks/gl/mock_gl_sharing.h"
1010
1111namespace OCLRT {
12- int GLSetSharedOCLContextStateCalled = 0 ;
13- int GLAcquireSharedBufferCalled = 0 ;
14- int GLAcquireSharedRenderBufferCalled = 0 ;
15- int GLAcquireSharedTextureCalled = 0 ;
16- int GLReleaseSharedBufferCalled = 0 ;
17- int GLReleaseSharedRenderBufferCalled = 0 ;
18- int GLReleaseSharedTextureCalled = 0 ;
19- int GLGetCurrentContextCalled = 0 ;
20- int GLGetCurrentDisplayCalled = 0 ;
21- int GLMakeCurrentCalled = 0 ;
22- int GLDeleteContextCalled = 0 ;
23- int WGLCreateContextCalled = 0 ;
24- int WGLShareListsCalled = 0 ;
25- int WGLDeleteContextCalled = 0 ;
2612int EGLCreateContextCalled = 0 ;
2713int EGLChooseConfigCalled = 0 ;
2814int EGLDeleteContextCalled = 0 ;
@@ -31,50 +17,16 @@ int GlxQueryContextCalled = 0;
3117int GlxCreateNewContextCalled = 0 ;
3218int GlxDeleteContextCalled = 0 ;
3319int GlxIsDirectCalled = 0 ;
34- int GLRetainSyncCalled = 0 ;
35- int GLReleaseSyncCalled = 0 ;
36- int GLGetSyncivCalled = 0 ;
37-
38- CL_GL_BUFFER_INFO bufferInfoInput = {0 };
39- CL_GL_BUFFER_INFO bufferInfoOutput = {0 };
40- CL_GL_RESOURCE_INFO textureInfoInput = {0 };
41- CL_GL_RESOURCE_INFO textureInfoOutput = {0 };
4220EGLBkpContextParams eglBkpContextParams = {0 };
4321GLXBkpContextParams glxBkpContextParams = {0 };
44- GLMockReturnedValues glMockReturnedValues = {0 };
4522
4623void GlSharingFunctionsMock::initMembers () {
47- GLSetSharedOCLContextState = mockGLSetSharedOCLContextState;
48- GLAcquireSharedBuffer = mockGLAcquireSharedBuffer;
49- GLAcquireSharedRenderBuffer = mockGLAcquireSharedRenderBuffer;
50- GLAcquireSharedTexture = mockGLAcquireSharedTexture;
51- GLReleaseSharedBuffer = mockGLReleaseSharedBuffer;
52- GLReleaseSharedRenderBuffer = mockGLReleaseSharedRenderBuffer;
53- GLReleaseSharedTexture = mockGLReleaseSharedTexture;
54- GLGetCurrentContext = mockGLGetCurrentContext;
55- GLGetCurrentDisplay = mockGLGetCurrentDisplay;
56- this ->wglMakeCurrent = mockWGLMakeCurrent;
57- GLReleaseSync = mockGlReleaseSync;
58- GLRetainSync = mockGlRetainSync;
59- GLGetSynciv = mockGlGetSynciv;
60- pfnWglCreateContext = mockWGlCreateContext;
61- pfnWglShareLists = mockWGlShareLists;
62- pfnWglDeleteContext = mockWGLDeleteContext;
63-
64- GLSetSharedOCLContextStateCalled = 0 ;
65- GLAcquireSharedBufferCalled = 0 ;
66- GLAcquireSharedRenderBufferCalled = 0 ;
67- GLAcquireSharedTextureCalled = 0 ;
68- GLReleaseSharedBufferCalled = 0 ;
69- GLReleaseSharedRenderBufferCalled = 0 ;
70- GLReleaseSharedTextureCalled = 0 ;
71- GLGetCurrentContextCalled = 0 ;
72- GLGetCurrentDisplayCalled = 0 ;
73- GLMakeCurrentCalled = 0 ;
74- GLDeleteContextCalled = 0 ;
75- WGLCreateContextCalled = 0 ;
76- WGLShareListsCalled = 0 ;
77- WGLDeleteContextCalled = 0 ;
24+ GLSharingFunctions::initGLFunctions ();
25+ glDllHelper dllParam;
26+ dllParam.setGLSetSharedOCLContextStateReturnedValue (1u );
27+ dllParam.resetParam (" " );
28+ dllParam.loadTexture ({0 });
29+ dllParam.loadBuffer ({0 });
7830 EGLChooseConfigCalled = 0 ;
7931 EGLCreateContextCalled = 0 ;
8032 EGLDeleteContextCalled = 0 ;
@@ -83,23 +35,15 @@ void GlSharingFunctionsMock::initMembers() {
8335 GlxCreateNewContextCalled = 0 ;
8436 GlxDeleteContextCalled = 0 ;
8537 GlxIsDirectCalled = 0 ;
86- GLRetainSyncCalled = 0 ;
87- GLReleaseSyncCalled = 0 ;
88- GLGetSyncivCalled = 0 ;
89- memset (&bufferInfoInput, 0 , sizeof (CL_GL_BUFFER_INFO));
90- memset (&bufferInfoOutput, 0 , sizeof (CL_GL_BUFFER_INFO));
91- memset (&textureInfoInput, 0 , sizeof (CL_GL_RESOURCE_INFO));
92- memset (&textureInfoOutput, 0 , sizeof (CL_GL_RESOURCE_INFO));
9338 memset (&eglBkpContextParams, 0 , sizeof (EGLBkpContextParams));
9439 memset (&glxBkpContextParams, 0 , sizeof (GLXBkpContextParams));
95- memset (&glMockReturnedValues, 0 , sizeof (GLMockReturnedValues));
9640}
9741
9842GlSharingFunctionsMock::GlSharingFunctionsMock () {
9943 initMembers ();
10044}
10145
10246MockGlSharing::MockGlSharing (GLType glhdcType, GLContext glhglrcHandle, GLContext glhglrcHandleBkpCtx, GLDisplay glhdcHandle) {
103- m_sharingFunctions. setHandles (glhdcType, glhglrcHandle, glhglrcHandleBkpCtx, glhdcHandle);
47+ sharingFunctions-> setHandles (glhdcType, glhglrcHandle, glhglrcHandleBkpCtx, glhdcHandle);
10448}
10549} // namespace OCLRT
0 commit comments