SWDEV-321079 - Blender GL interop Linux fix

Change-Id: I920d30c575627c443a1d2e93c02abf8658bc3978
此提交包含在:
Payam
2022-02-04 19:20:46 -05:00
提交者 Payam Ghafari
父節點 1f8c42deee
當前提交 9faac0fe8d
共有 3 個檔案被更改,包括 45 行新增1 行删除
+43
查看文件
@@ -2283,6 +2283,49 @@ GLFunctions::~GLFunctions() {
}
#endif //!_WIN32
}
// in case of HIP GL interop we want to make sure we have the updated context
bool GLFunctions::update(intptr_t hglrc) {
#ifdef _WIN32
DWORD err;
if (hOrigGLRC_ == (HGLRC)hglrc) {
return true;
}
hOrigGLRC_ = (HGLRC)hglrc;
if (hIntGLRC_ != nullptr) {
wglDeleteContext_(hIntGLRC_);
}
if (!(hIntGLRC_ = wglCreateContext_(wglGetCurrentDC_()))) {
err = GetLastError();
return false;
}
if (!wglShareLists_(hOrigGLRC_, hIntGLRC_)) {
err = GetLastError();
return false;
}
#else //!_WIN32
Dpy_ = glXGetCurrentDisplay_();
Drawable_ = glXGetCurrentDrawable_();
if (origCtx_ == (GLXContext)hglrc) {
return true;
}
origCtx_ = (GLXContext)hglrc;
if (intCtx_ != nullptr) {
glXDestroyContext_(Dpy_,intCtx_);
}
int attribList[] = {GLX_RGBA, None};
XVisualInfo* vis;
int defaultScreen = DefaultScreen(intDpy_);
if (!(vis = glXChooseVisual_(intDpy_, defaultScreen, attribList))) {
return false;
}
if (!(intCtx_ = glXCreateContext_(intDpy_, vis, origCtx_, true))) {
return false;
}
#endif
return true;
}
bool GLFunctions::init(intptr_t hdc, intptr_t hglrc) {
if (isEGL_) {
+1
查看文件
@@ -310,6 +310,7 @@ public:
GLFunctions(HMODULE h, bool isEGL);
~GLFunctions();
bool update(intptr_t hglrc);
bool IsCurrentGlContext(const amd::Context::Info& info) const {
if (isEGL_) {
return ((info.hCtx_ != nullptr) && (eglGetCurrentContext_ != nullptr) &&
+1 -1
查看文件
@@ -116,8 +116,8 @@ hipError_t hipGLGetDevices(unsigned int* pHipDeviceCount, int* pHipDevices,
info.hCtx_ = glenv->glXGetCurrentContext_();
#endif
hip::getCurrentDevice()->asContext()->setInfo(info);
glenv->update(reinterpret_cast<intptr_t>(info.hCtx_));
}
*pHipDeviceCount = 0;
switch (deviceList) {
case hipGLDeviceListCurrentFrame: