1
1
/*
2
- * Copyright (C) 2018 Intel Corporation
2
+ * Copyright (C) 2018-2019 Intel Corporation
3
3
*
4
4
* SPDX-License-Identifier: MIT
5
5
*
9
9
#include " unit_tests/mocks/gl/mock_gl_sharing.h"
10
10
11
11
namespace 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 ;
26
12
int EGLCreateContextCalled = 0 ;
27
13
int EGLChooseConfigCalled = 0 ;
28
14
int EGLDeleteContextCalled = 0 ;
@@ -31,50 +17,16 @@ int GlxQueryContextCalled = 0;
31
17
int GlxCreateNewContextCalled = 0 ;
32
18
int GlxDeleteContextCalled = 0 ;
33
19
int 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 };
42
20
EGLBkpContextParams eglBkpContextParams = {0 };
43
21
GLXBkpContextParams glxBkpContextParams = {0 };
44
- GLMockReturnedValues glMockReturnedValues = {0 };
45
22
46
23
void 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 });
78
30
EGLChooseConfigCalled = 0 ;
79
31
EGLCreateContextCalled = 0 ;
80
32
EGLDeleteContextCalled = 0 ;
@@ -83,23 +35,15 @@ void GlSharingFunctionsMock::initMembers() {
83
35
GlxCreateNewContextCalled = 0 ;
84
36
GlxDeleteContextCalled = 0 ;
85
37
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));
93
38
memset (&eglBkpContextParams, 0 , sizeof (EGLBkpContextParams));
94
39
memset (&glxBkpContextParams, 0 , sizeof (GLXBkpContextParams));
95
- memset (&glMockReturnedValues, 0 , sizeof (GLMockReturnedValues));
96
40
}
97
41
98
42
GlSharingFunctionsMock::GlSharingFunctionsMock () {
99
43
initMembers ();
100
44
}
101
45
102
46
MockGlSharing::MockGlSharing (GLType glhdcType, GLContext glhglrcHandle, GLContext glhglrcHandleBkpCtx, GLDisplay glhdcHandle) {
103
- m_sharingFunctions. setHandles (glhdcType, glhglrcHandle, glhglrcHandleBkpCtx, glhdcHandle);
47
+ sharingFunctions-> setHandles (glhdcType, glhglrcHandle, glhglrcHandleBkpCtx, glhdcHandle);
104
48
}
105
49
} // namespace OCLRT
0 commit comments