像素路径性能警告:像素传输与 3D 渲染同步 [英] Pixel-path performance warning: Pixel transfer is synchronized with 3D rendering

查看:69
本文介绍了像素路径性能警告:像素传输与 3D 渲染同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将图像数据上传到 GL 纹理 异步.

I am uploading image data into GL texture asynchronously.

在调试输出中,我在渲染过程中收到这些警告:

In debug output I am getting these warnings during the rendering:

来源:OpenGL,类型:其他,id:131185,严重性:通知
消息:缓冲区详细信息:缓冲区对象 1(绑定到GL_PIXEL_UNPACK_BUFFER_ARB,使用提示是 GL_DYNAMIC_DRAW) 已经在系统堆内存中映射 WRITE_ONLY(快速).来源:OpenGL,类型:性能,ID:131154,严重性:中等消息:像素路径性能警告:像素传输与 3D 渲染同步.

Source:OpenGL,type: Other, id: 131185, severity: Notification
Message: Buffer detailed info: Buffer object 1 (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) has been mapped WRITE_ONLY in SYSTEM HEAP memory (fast). Source:OpenGL,type: Performance, id: 131154, severity: Medium Message: Pixel-path performance warning: Pixel transfer is synchronized with 3D rendering.

在我的案例中,我看不到 PBO 的任何错误用法或任何错误.所以问题是,这些警告是否可以安全地丢弃,或者我实际上做错了什么.

I can't see any wrong usage of PBOs in my case or any errors.So the questions is, if these warnings are safe to discard, or I am actually doing smth wrong.

我的那部分代码:

    //start copuying pixels into PBO from RAM:
    mPBOs[mCurrentPBO].Bind(GL_PIXEL_UNPACK_BUFFER);

    const uint32_t buffSize = pipe->GetBufferSize();
    GLubyte* ptr = (GLubyte*)mPBOs[mCurrentPBO].MapRange(0, buffSize, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
    if (ptr)
    {
        memcpy(ptr, pipe->GetBuffer(), buffSize);
        mPBOs[mCurrentPBO].Unmap();
    }

  //copy pixels from another already full PBO(except of first frame into texture //
    mPBOs[1 - mCurrentPBO].Bind(GL_PIXEL_UNPACK_BUFFER);
     //mCopyTex is bound to mCopyFBO as attachment
    glTextureSubImage2D(mCopyTex->GetHandle(), 0, 0, 0, mClientSize.x, mClientSize.y,
            GL_RGBA, GL_UNSIGNED_BYTE, 0);

    mCurrentPBO = 1 - mCurrentPBO;

然后我只是将结果 blit 到默认帧缓冲区.没有几何图形或类似的渲染.

Then I just blit the result to default frame buffer. No rendering of geometry or anything like that.

  glBlitNamedFramebuffer(
            mCopyFBO,
            0,//default FBO id
            0,
            0,
            mViewportSize.x,
            mViewportSize.y,
            0,
            0,
            mViewportSize.x,
            mViewportSize.y,
            GL_COLOR_BUFFER_BIT,
            GL_LINEAR);

在 NVIDIA GTX 960 卡上运行.

Running on NVIDIA GTX 960 card.

推荐答案

此性能警告是针对 nividia 的,旨在提示您不会使用单独的硬件传输队列,即难怪您使用单线程、单 GL 上下文模型,在其中执行渲染(至少是您的 blit)和传输.

This performance warning is nividia-specific and it is intended as a hint to tell you that you're not going to use a separate hw transfer queue, which is no wonder since you use a single thread, single GL context model, where both rendering (at least your your blit) and transfer are carried out.

请参阅此 nvidia 演示文稿有关 nvidia 如何处理此问题的一些详细信息.第 22 页还解释了此特定警告.请注意,此警告意味着您的传输不是异步的.它仍然与 CPU 线程完全异步.对于同一命令队列中的渲染命令,它只会在 GPU 上同步处理,并且您没有使用异步复制引擎,该引擎可以独立于单独命令队列中的渲染命令执行这些复制.

See this nvidia presentation for some details about how nvidia handles this. Page 22 also explains this specific warning. Note that this warnign does not mean that your transfer is not asynchronous. It is still fully asynchronous to the CPU thread. It will just be synchronously processed on the GPU, with respect to the render commands which are in the same command queue, and you're not using the asynchronous copy engine which could do these copies independent from the rendering commands in a separate command queue.

在我的案例中,我看不到 PBO 的任何错误用法或任何错误.所以问题是,这些警告是否可以安全地丢弃,或者我实际上做错了什么.

I can't see any wrong usage of PBOs in my case or any errors.So the questions is, if these warnings are safe to discard, or I am actually doing smth wrong.

您的 PBO 用法没有任何问题.

There is nothing wrong with your PBO usage.

不清楚您的特定应用程序是否可以从使用更精细的单独传输队列方案中受益.

It is not clear if your specific application could even benefit from using a more elaborate separate transfer queue scheme.

这篇关于像素路径性能警告:像素传输与 3D 渲染同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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