2018-08-27 22:30:40 +08:00
|
|
|
/*
|
2020-01-14 21:32:11 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-08-27 22:30:40 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-08-27 22:30:40 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/context/gl/context_gl_tests.h"
|
2018-08-27 22:30:40 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/sharings/gl/gl_sharing.h"
|
2020-03-17 21:25:44 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-01-20 18:44:59 +08:00
|
|
|
namespace NEO {
|
2018-08-27 22:30:40 +08:00
|
|
|
|
2020-01-20 18:44:59 +08:00
|
|
|
TEST_F(GlContextTest, GivenDefaultContextThenGlSharingIsDisabled) {
|
|
|
|
ASSERT_EQ(context->getSharing<GLSharingFunctions>(), nullptr);
|
2018-08-27 22:30:40 +08:00
|
|
|
}
|
|
|
|
|
2020-01-20 18:44:59 +08:00
|
|
|
TEST_F(GlContextTest, GivenGlContextParamWhenCreateContextThenInitSharingFunctions) {
|
2018-08-27 22:30:40 +08:00
|
|
|
cl_device_id deviceID = devices[0];
|
2019-03-26 18:59:46 +08:00
|
|
|
auto pPlatform = NEO::platform();
|
2018-08-27 22:30:40 +08:00
|
|
|
cl_platform_id pid[1];
|
|
|
|
pid[0] = pPlatform;
|
|
|
|
|
|
|
|
cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)pid[0], CL_GL_CONTEXT_KHR, 0x10000, 0};
|
|
|
|
cl_int retVal = CL_SUCCESS;
|
2020-01-14 21:32:11 +08:00
|
|
|
auto ctx = Context::create<Context>(validProperties, ClDeviceVector(&deviceID, 1), nullptr, nullptr, retVal);
|
2018-08-27 22:30:40 +08:00
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
ASSERT_NE(nullptr, ctx);
|
|
|
|
|
|
|
|
auto sharing = ctx->getSharing<GLSharingFunctions>();
|
|
|
|
ASSERT_NE(nullptr, sharing);
|
|
|
|
EXPECT_FALSE(context->getInteropUserSyncEnabled());
|
|
|
|
|
|
|
|
delete ctx;
|
|
|
|
}
|
2020-01-20 18:44:59 +08:00
|
|
|
} // namespace NEO
|