在没有上下文共享的情况下在两个上下文之间共享纹理/图像的最佳方法是什么? [英] What's the best way to share a texture/image between two context with out context sharing?

查看:93
本文介绍了在没有上下文共享的情况下在两个上下文之间共享纹理/图像的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要做的是从一个上下文中获取渲染结果,并在另一个与上一个上下文不共享的上下文中进行进一步的渲染.

What I want to do is to get the render result from one context, and do some further rendering in another context which do not shared with the previous one.

我唯一能想到的方法是使用glReadPixels(如API)将渲染结果从GPU内存复制到系统内存,并在另一个上下文中使用复制的数据.

The only method I can come up with is that copy the render result from GPU memory to system memory using glReadPixels like APIs and use the copied data in another context.

是否有更好的方法可以做到这一点?我的意思是无需将数据从GPU内存复制到系统内存,再将系统复制到GPU.

Is there a better way to do this? I mean without copying the data from GPU memory to system memory and system to GPU again.

我正在Linux下使用GLX.

I am working with GLX under Linux.

推荐答案

我不知道正确共享它们的方法.我可以找到的最接近GLX的是 GLX_NV_copy_image 扩展名.引言中说:

I'm not aware of a way to share them correctly. The closest I could find for GLX is the GLX_NV_copy_image extension. In the introduction, it says:

WGL和GLX版本允许在不同上下文中的图像之间进行复制,即使这些上下文位于不同的共享列表中,甚至位于不同的物理设备上.

The WGL and GLX versions allow copying between images in different contexts, even if those contexts are in different sharelists or even on different physical devices.

使用此扩展名,您将使用glXCopyImageSubDataNV()函数从一个上下文复制到另一个上下文.尽管这不允许共享,但它可能比自己复制数据要快得多.

With this extension, you would use the glXCopyImageSubDataNV() function to copy from one context to the other. While this does not allow sharing, it might still be much faster than copying the data yourself.

您已经可以从名称中得知,这是特定于供应商的扩展名.我不知道它有多广泛的支持,但是您当然不应该指望它在所有系统上都存在.

As you can already tell from the name, this is a vendor specific extension. I don't know how widely supported it is, but you certainly shouldn't count on it being present on all systems.

其他窗口系统绑定具有即使在进程之间也可以共享图像的机制.例如.对于与OpenGL ES一起使用的EGL,EGLImage可用于此目的.但是,通过浏览GLX规范和扩展列表,我找不到那里的类似内容.

Other window system bindings have mechanisms for sharing images even between processes. E.g. with EGL, which is used with OpenGL ES, EGLImage can be used for this purpose. But from browsing through the GLX spec and list of extensions, I couldn't spot anything similar there.

这篇关于在没有上下文共享的情况下在两个上下文之间共享纹理/图像的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆