gpt4 book ai didi

c++ - 像素路径性能警告 : Pixel transfer is synchronized with 3D rendering

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:32:54 35 4
gpt4 key购买 nike

我正在将图像数据上传到 GL 纹理中 asynchronously .

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

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 或任何错误。所以问题是,如果这些警告可以安全丢弃,或者我实际上做错了事。

我的那部分代码:

    //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 到默认帧缓冲区。没有几何渲染或类似的东西。

  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 显卡上运行。

最佳答案

此性能警告是特定于 nividia 的,它旨在作为一个提示告诉您您不会使用单独的硬件传输队列,这并不奇怪,因为您使用的是单线程、单 GL 上下文模型,进行渲染(至少是你的 blit)和传输的地方。

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

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 的使用没有任何问题。

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

关于c++ - 像素路径性能警告 : Pixel transfer is synchronized with 3D rendering,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49368575/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com