Advertisement

Why my DirectX12 App has very high CPU utilization and low GPU utilization??

Started by March 28, 2023 01:13 PM
4 comments, last by Neooooo 1 year, 8 months ago

Hi ! My friends! I am a rookie in DirectX12.Recently,I am writing a simple graphic engine.But when I run it,I found a terrible problem,which is my app has very high CPU utilization and low GPU utilization.My app just loads a sponza scene with one directional light to generate shadow.However,the cpu utilization rate is as high as 50%, while the gpu utilization rate is almost zero, resulting in only 20 frame rates.I believe that it is an unreasonable result for my hardware(CPU:I7-9700k GPU:Nvidia 3080).And I really don't know why this happens.Please help me!!!

You can find all code of my app in my gitjhub.rookiesinchina/NeoEngine: NeoEngine main files (github.com).And you can easily find render loop in main file.

I look forward to your reply! Thank you very much!

None

What does your profiler tell you? If you don't have one already, get PIX here. It can look at your CPU and GPU performance and tell you where your program is spending its time.

Advertisement

I am not well versed in modern cpp or dx12, but it seems you are hammering the api too much. Your code reminds me of my old opengl code, which basically relied on opengl to perform basically everything. This was a standard - and wrong - practice back then, but nowadays, people are usually try to separate every api related functionality and implementation into a separate file, and they try to keep it extremely simple and short, so if there is something wrong (or they want to add other api), they can instantly relatively easily can solve the problems. Meanwhile your code looks like very reliant on the api and on the compiler itself, i am having a hard time figuring out what is supposed to do what.

So what i am recommending you is - instead of trying to hunt down this particular performance bug - to reorganize everything while you can, and then maybe the bug will automatically reveal itself.

@Geri Thanks for your idea! I will try it!

None

@frob Yes.I am trying to use PIX to find where the problem is. But,you know,I am a freshman in DirectX. So the process is a bit difficult for me.Could you please tell me some good tutorials about DirectX12 or PIX?Thank you again for this!

None

This topic is closed to new replies.

Advertisement