From 6cb3ef5d42d91beb9260d9c78be68c18fc3713d8 Mon Sep 17 00:00:00 2001 From: pghafari Date: Tue, 12 Oct 2021 11:04:51 -0400 Subject: [PATCH] SWDEV-245531 - GLInterop: updating glEnv logic Change-Id: I6103243c477547a6a2b714bbf836ce36abe84f8c [ROCm/clr commit: 5b6b2e6d2cfac094228c948f0964351b2d146022] --- projects/clr/rocclr/platform/context.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/clr/rocclr/platform/context.cpp b/projects/clr/rocclr/platform/context.cpp index 6fc9bc7f2a..dbb46c38a9 100644 --- a/projects/clr/rocclr/platform/context.cpp +++ b/projects/clr/rocclr/platform/context.cpp @@ -294,6 +294,18 @@ int Context::create(const intptr_t* properties) { } } else { if (info_.flags_ & GLDeviceKhr) { + if (glenv_ == NULL) { + HMODULE h = (HMODULE)Os::loadLibrary( +#ifdef _WIN32 + "OpenGL32.dll" +#else //!_WIN32 + "libGL.so.1" +#endif //!_WIN32 + ); + if (!h || !(glenv_ = new GLFunctions(h, (info_.flags_ & Flags::EGLDeviceKhr) != 0))) { + return CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR; + } + } if (!glenv_->init(reinterpret_cast(info_.hDev_[GLDeviceKhrIdx]), reinterpret_cast(info_.hCtx_))) { delete glenv_;