Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复光栅化渲染管线中的线程同步问题 #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

greyishsong
Copy link
Member

src/render/graphics_interfaces.h 中,Context::vertex_finish 等标志变量均应标记为 volatile。否则,实际执行时可能因多核缓存不一致而导致各流水段的线程不能按顺序结束,得到错误的渲染结果。

由于发布前的疏忽,相关代码没有从 dev channel 移植过来,目前已经 有同学测试出了问题

@greyishsong
Copy link
Member Author

使用 volatile 能解决编译器优化问题,但根据 cpp reference: volatile,它不一定能解决多核缓存一致性问题,该 PR 不会被马上合并,需要继续测试。

@rouge3877
Copy link

我将新分支clone下来后将basic和render部分的已经完成的实验代码合并,目前发现了两个问题:

  1. 是编译出现了conflicting declaration,原因似乎是在 graphics_interface.h 中,vertex_finishrasterizer_finishfragment_finish 被声明为 volatile static bool,而在 rasterizer_renderer.cpp 中,它们重新定义为 bool
  2. 是当我手动将 rasterizer_renderer.cpp 中的定义和头文件中的统一后,release模式下编译后依然存在eb fe问题,其他的问题还未测试
    image|690x460

我的环境如下:
image

@greyishsong greyishsong requested a review from JoTaiLang October 17, 2024 13:33
@greyishsong
Copy link
Member Author

greyishsong commented Oct 17, 2024

  • 编译问题是我改了变量声明之后没有同步修改 cpp 文件中变量定义导致的
  • 我重新检查了一下,还发现两个 worker_thread 中外层循环的终止条件也不对

新的 commit 已经修正了这两个问题,@rouge3877 如果有时间的话也麻烦帮忙测试一下最新的提交是否解决了问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants