Add check that Intel OpenGl is used

before return device_id in clGetGlContextInfoKHR
Change-Id: Ic6dce407a1666909d468d89a8576c907abc63b61
This commit is contained in:
Katarzyna Cencelewska
2019-01-03 16:31:40 +01:00
committed by sys_ocldev
parent cdd77a34fa
commit 72f17d6435
12 changed files with 127 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2017-2018 Intel Corporation
# Copyright (C) 2017-2019 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -9,6 +9,7 @@ if(WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/gl_os_sharing_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gl_options.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gl_dll_helper.h
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_os_interface_windows_gl})
endif()

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/os_interface/os_library.h"
#include "Gl/gl.h"
using namespace OCLRT;
namespace Os {
extern const char *openglDllName;
}
typedef void (*GLString)(const char *, unsigned int);
struct glDllHelper {
public:
glDllHelper() {
glDllLoad.reset(OsLibrary::load(Os::openglDllName));
if (glDllLoad) {
glSetString = (*glDllLoad)["glSetString"];
UNRECOVERABLE_IF(glSetString == nullptr);
}
}
~glDllHelper() {
if (glDllLoad) {
glSetString("Intel", GL_VENDOR);
glSetString("4.0", GL_VERSION);
}
}
GLString glSetString = nullptr;
private:
std::unique_ptr<OsLibrary> glDllLoad;
};