- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
为了进行基准测试,让我们采用这个著名的 PBO Read-back code .
问题:
更新 1:我也用 3 个 PBO 尝试过同样的例子。但即使那样也没有区别。
注意:Intel(R) Core(TM) i5-3470S CPU @ 2.90GHz,2901 Mhz,4 核,显卡:Intel(R) HD Graphics 2500
PBO: off
Read Time: 9 ms
Process Time: 2 ms
Transfer Rate: 39.5 Mpixels/s. (45.0 FPS)
PBO: on
Read Time: 7 ms
Process Time: 2 ms
PBO: on Transfer Rate: 38.8 Mpixels/s. (44.2 FPS)
更新 2:PBO 在外部 GPU 和 Intel i-7 系列中正常工作。
电脑配置:Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3400 Mhz, 4 Core(s), 8 Logical Processor(s),Video Card: Geforce 210. 所以结果是问题集成 GPU 和外部 GPU。我相信这对很多想知道为什么他们的代码不能工作的人来说是一个有用的提示!
PBO: on
PBO: on Read Time: 0.06 ms
Process Time: 2 ms
Transfer Rate: 112.4 Mpixels/s. (127.9 FPS)
PBO: off
Read Time: 4 ms
Process Time: 2 ms
Transfer Rate: 93.3 Mpixels/s. (106.1 FPS)
最佳答案
在link :
Mapping PBO ...
Note that if GPU is still working with the buffer object, glMapBufferARB() will not return until GPU finishes its job with the corresponding buffer object. To avoid this stall(wait), call glBufferDataARB() with NULL pointer right before glMapBufferARB(). Then, OpenGL will discard the old buffer, and allocate new memory space for the buffer object.
您可能需要将上述建议的更改应用到以下代码:
// "index" is used to read pixels from framebuffer to a PBO
// "nextIndex" is used to update pixels in the other PBO
index = (index + 1) % 2;
nextIndex = (index + 1) % 2;
// set the target framebuffer to read
glReadBuffer(GL_FRONT);
// read pixels from framebuffer to PBO
// glReadPixels() should return immediately.
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[index]);
glReadPixels(0, 0, WIDTH, HEIGHT, GL_BGRA, GL_UNSIGNED_BYTE, 0);
// map the PBO to process its data by CPU
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[nextIndex]);
glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, 0, NULL, GL_STATIC_DRAW_ARB);
GLubyte* ptr = (GLubyte*)glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB,
GL_READ_ONLY_ARB);
if(ptr)
{
processPixels(ptr, ...);
glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
}
// back to conventional pixel operation
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
关于c++ - PBO 在集成 GPU 中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28338390/
阅读后this文章我想尝试做同样的事情,但为了加速我希望在 GPU 上执行的渲染部分,不用说为什么三角形或任何其他几何对象应该在 GPU 而不是 CPU 上渲染。 这是该过程的一张很好的图片: 任务:
我在 OpenGL 中阅读了一些关于 PBO 的内容,我遇到了一个关于竞争条件的问题。 让我们来看下面的例子:我有两个 PBO,我想将它们的像素数据轮流传输到一个纹理对象。因此,当我为一个 PBO 启
我正在使用 PBO 在我的 cpu 和 gpu 之间异步移动数据。 当从 GPU 移动时,我知道在 PBO 上调用 glMapBuffer 后我可以删除源纹理。 但是,反过来呢?我什么时候知道从 PB
我有一个多线程 OpenGL 应用程序,它使用 PBO 在 cpu 和 gpu 之间传输数据。 我已经合并了 PBO 的分配,但是,当池为空时,我的非 opengl 线程必须阻塞一段时间,直到 Ope
我有一个 CUDA 缓冲区访问问题:我注册了一个 OpenGL 缓冲区以将其与 CUDA 一起使用,cudaGraphicsGLRegisterBuffer() 没有返回错误(即 cudasucess
我有一个应用程序,它使用 Opengl 和像素缓冲区对象执行大量 GPGPU 来传输和处理数据。 目前我使用了这些资源的池,基本上我有一个池用于我的应用程序使用的每个缓冲区尺寸和用法。当资源的使用结束
好的,我在这里阅读了有关 PBO 的所有内容:http://www.opengl.org/wiki/Pixel_Buffer_Object还有http://www.songho.ca/opengl/g
请告诉我一些 OpenGL 4.0 的限制: 1) 我最多可以创建多少 FBO? 2) 我最多可以创建多少个 PBO? 谢谢! 最佳答案 最大值取决于您拥有的 RAM + 视频 RAM 的数量(以及每
我想使用两个 PBO 以替代方式读取像素。我认为PBO方式会快很多,因为glReadPixels在使用PBO时会立即返回,并且很多时间可以重叠。 奇怪的是,似乎没有太大的好处。考虑一些代码,如:
我正在尝试异步读取帧缓冲区,但 glReadPixels() 会生成 INVALID_OPERATION 错误。 我已经阅读了可能导致此错误的原因,但我在代码中没有发现任何问题: int PBOHa
我正在使用 PBO 截屏。但是,结果图像全黑。它在没有 PBO 的情况下工作得很好。在执行此操作之前,我需要注意什么吗? 我什至尝试渲染到 FBO 然后使用 GLES30.glReadBuffer(G
我无法使用 gcc 中的 PBO 选项 (-fprofile-generate & -fprofile-use) 优化我的代码。 我首先像下面这样编译我的代码:gcc -fprofile-genera
为了进行基准测试,让我们采用这个著名的 PBO Read-back code . 问题: 在我的 PC 上使用 PBO 无效。即使使用最新的驱动程序更新并更正像素格式 BGRA。 更新 1:我也用 3
在 Android 上,我尝试对相机帧执行一些 OpenGL 处理,在相机预览中显示这些帧,然后在视频文件中对这些帧进行编码。我正在尝试使用 OpenGL,使用 GLSurfaceView 和 GLS
我需要在屏幕上快速绘制像素。 我发现了这个有趣的页面 Fast pixel drawing library 作者发表:“将 OpenGL 纹理与 PBO 一起使用似乎是最佳选择。谢谢。” 我想我需要的
我可以使用像素缓冲区对象 (PBO) 直接从 FBO 读取像素值(即使用 glReadPixels)(即在 FBO 仍处于连接状态时)吗? 如果是, 将 PBO 与 FBO 结合使用有哪些优点和缺点?
在愉快地使用 PyOpenGL 一段时间后,我现在陷入了严重的困境。我正在开发一个 Python 包,它允许我使用 GLSL 着色器和 OpenCL 程序进行图像处理,使用纹理作为将数据传入和传出 G
我正在开发一个应用程序,需要从 openGL 应用程序的前端缓冲区读回整个帧。我可以劫持应用程序的 opengl 库并将我的代码插入交换缓冲区。目前,我成功地使用了一个简单但极其缓慢的 glReadP
我正在做一个项目,用 OpenGL 显示视频流,然后在外部屏幕上显示 QOpenGLWidget 上的内容。所以我所做的是在 OpenGL 小部件上显示流,然后我使用 glReadPixels 和两个
我的目标是从主窗口获取像素数据。没有任何渲染。就像我们看到屏幕截图之类的监视器。 我试过透明窗口,glReadPixel。所以我有一个透明的窗口和上下文。 glfwSetErrorCallback(e
我是一名优秀的程序员,十分优秀!