mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Add check that Intel OpenGl is used
before return device_id in clGetGlContextInfoKHR Change-Id: Ic6dce407a1666909d468d89a8576c907abc63b61
This commit is contained in:
committed by
sys_ocldev
parent
cdd77a34fa
commit
72f17d6435
@@ -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()
|
||||
|
||||
37
unit_tests/os_interface/windows/gl/gl_dll_helper.h
Normal file
37
unit_tests/os_interface/windows/gl/gl_dll_helper.h
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user