DirectX 9 and 11 Benchmark on Instancing example

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
Arthurfernandes
Halfling
Posts: 49
Joined: Mon Oct 28, 2024 10:50 pm
x 7

DirectX 9 and 11 Benchmark on Instancing example

Post by Arthurfernandes »

Hey everyone!

Recently I made a benchmark with two different PCs to see the difference between using DX9 and DX11. All tests were made with FSAA 8, 1080p and VSync off.

  • Sample configuration:

OBS: Only FSAA and Render system are different.
Image

An example showing how the test was made.
Image


PC 1 specs:

  • OS: Windows 10 64-bit (19045);

  • Motherboard: GA-78LMT-USB3 6.0;

  • CPU: AMD FX-8320E (8 CPUs), 3.2GHz;

  • RAM: 16GB;

  • GPU: NVIDIA GeForce GTX 960 (2GB).

Results:

  • DX11: 6 FPS (AVG) - 10.9% (GPU) - 15% (CPU)

  • DX9 Ex: 5.7 FPS (AVG) - 22.7% (GPU) - 16.2% (CPU)

  • DX9: 5.9 FPS (AVG) - 23.3% (GPU) - 16.9% (CPU)


PC 2 specs:

  • OS: Windows 10 Pro 64-bit (19045);

  • Motherboard: B760M D2H DDR4;

  • CPU: i5-12400F (12 CPUs), 2.5GHz;

  • RAM: 32GB DDR4;

  • GPU: NVIDIA GeForce RTX 4070 SUPER (12GB).

Results:

  • DX11: 21.4 FPS (AVG) - 5.1% (GPU) - 15.3% (CPU)

  • DX9 Ex: 21.9 FPS (AVG) - 16.5% (GPU) - 17.1% (CPU)

  • DX9: 21.8 FPS (AVG) - 16.9% (GPU) - 16.9% (CPU)

I really don't understand much about how 3D graphics work, and I'm curious why the GPU and CPU have such low usage. Based on the usage, it seems like I could get more FPS, because my GPU is using less than half its capacity — but the scenario is different.

rpgplayerrobin
Orc Shaman
Posts: 746
Joined: Wed Mar 18, 2009 3:03 am
x 418

Re: DirectX 9 and 11 Benchmark on Instancing example

Post by rpgplayerrobin »

In your scenario, the CPU might be the bottleneck.

Your CPU might have multiple cores, and only the main core will be used with Ogre by default.
This means that if you have 8 cores, you will only be able to use 12.5% of your CPU in Ogre without yourself using threading for your own game logic and such.
That is why your CPU is so low and not at >99%

But, why your GPU is low is different.
My game is almost always >95% usage in the GPU, but in your test scene your bottleneck might be to send the batches to your GPU (since you have quite many batches in your scene), which in turn lowers the FPS by a lot. Since most of the time taken is in the CPU, the GPU might just be sitting there and waiting until you have work for it, which would explain its low usage.

Also, measuring something usually requires different scenes and more computers.
For example, here is a comparison I have on multiple computers between D3D9 and D3D11:

Code: Select all

4095MB NVIDIA Geforce RTX 3060:
	Start game scene: 			430 FPS D3D9 vs 500 D3D11
	Skyislands scene: 		 	162 FPS D3D9 vs 166 D3D11

4095MB NVIDIA Geforce RTX 3060:
	Start game scene: 			380 FPS D3D9 vs 440 D3D11
	Skyislands scene: 		 	112 FPS D3D9 vs 112 D3D11

4095MB NVIDIA Geforce RTX 3070 Ti:
	Start game scene: 			500 FPS D3D9 vs 500 D3D11
	Skyislands scene: 		 	200 FPS D3D9 vs 192 D3D11

NVIDIA GeForce RTX 3050:
	Start game scene 1080p: 		263 FPS D3D9 vs 262 D3D11
	Skyislands scene 1080p: 		103 FPS D3D9 vs  97 D3D11

NVIDIA GeForce GTX 1050 Ti:
	Start game scene 1080p: 		152 FPS D3D9 vs 173 D3D11
	Skyislands scene 1080p: 		 75 FPS D3D9 vs  62 D3D11

As you may see, D3D9 and D3D11 are sometimes better, and sometimes worse. It has to do with what you are rendering and what computer it is.
But the difference is usually not that great, unless you are actually using more advanced rendering techniques for D3D11 (such as texture arrays or compute shaders, but those also has their own downsides).

paroj
OGRE Team Member
OGRE Team Member
Posts: 2189
Joined: Sun Mar 30, 2014 2:51 pm
x 1178

Re: DirectX 9 and 11 Benchmark on Instancing example

Post by paroj »

use the "Hardware Instancing Basic" Technique for better GPU utilization.

User avatar
Arthurfernandes
Halfling
Posts: 49
Joined: Mon Oct 28, 2024 10:50 pm
x 7

Re: DirectX 9 and 11 Benchmark on Instancing example

Post by Arthurfernandes »

@rpgplayerrobin

Really cool explanation, thank you very much!

As you said, the bottleneck is probably because Ogre uses only one thread of my CPU. They changed this in Ogre Next, right?

User avatar
Arthurfernandes
Halfling
Posts: 49
Joined: Mon Oct 28, 2024 10:50 pm
x 7

Re: DirectX 9 and 11 Benchmark on Instancing example

Post by Arthurfernandes »

paroj wrote: Tue May 13, 2025 12:39 pm

use the "Hardware Instancing Basic" Technique for better GPU utilization.

When I was testing, I did try it, but the quality was quite a bit lower. Is there any explanation about the use of both techniques?

rpgplayerrobin
Orc Shaman
Posts: 746
Joined: Wed Mar 18, 2009 3:03 am
x 418

Re: DirectX 9 and 11 Benchmark on Instancing example

Post by rpgplayerrobin »

Arthurfernandes wrote: Tue May 13, 2025 4:16 pm
paroj wrote: Tue May 13, 2025 12:39 pm

use the "Hardware Instancing Basic" Technique for better GPU utilization.

When I was testing, I did try it, but the quality was quite a bit lower. Is there any explanation about the use of both techniques?

I would not worry about the quality much, since if the model itself it lit differently or something, it has nothing to do with the actual technique, just that the shaders are different (for some reason).

Here is an explanation for them:
https://ogrecave.github.io/ogre/api/lat ... ncing.html

This all depends on what you want to do. If you need instancing with animation, you should use an instancing technique that can handle that. But if you do not need that and only need it for static geometry, you should use a more basic instancing shader.

Note that instancing has a cost, so you can not just enable it on all your models and expect an FPS increase. You might need a lot of the same model on the screen before you actually gain any performance.

As you said, the bottleneck is probably because Ogre uses only one thread of my CPU. They changed this in Ogre Next, right?

I don't know. But this is usually not a problem. It might depend on which instancing technique you are using.