Added - DirectX 9Ex implementation
-
- OGRE Retired Team Member
- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
Added - DirectX 9Ex implementation
Just commited 3 changesets to support directX 9Ex into the trunk (5dd1e48221b7, 89af5353438c and 0236c0a19522).
main points of this system are: Less likely to produce device loss. Faster buffer swap. no managed pool.
see http://msdn.microsoft.com/en-us/library ... s.85).aspx for further details.
Option for using DirectX 9Ex ("Allow DirectX9Ex") is turned of by default as it can cause crashes.
If you attempt to lock a static buffer the program will crash. though in most cases the system prevents you from doing so.
Notes:
1.
when you create a manual texture in while using DirectX 9Ex. If you create this texture with a TU_STATIC usage, the system automaticlly changes this to TU_DYNAMIC to prevent failure of lock crashes.
If someone can think of a better code for this let me know.
2.
FYI The reason I implemented DirectX 9Ex is because it's needed to support an NVidia API which allow rendering OpenGL content in DirectX and vice versa. See http://developer.download.nvidia.com/op ... nterop.txt for details
3.
to Wolfmanfx
Sorry if I mislead you about DirectX 9Ex. Turns out it's a very small change to the system, so you don't really need to create a whole new render system just for the 9Ex option. you can Piggyback on the regular DirectX 9 (accept for a couple of small changed its preaty much the same code)
main points of this system are: Less likely to produce device loss. Faster buffer swap. no managed pool.
see http://msdn.microsoft.com/en-us/library ... s.85).aspx for further details.
Option for using DirectX 9Ex ("Allow DirectX9Ex") is turned of by default as it can cause crashes.
If you attempt to lock a static buffer the program will crash. though in most cases the system prevents you from doing so.
Notes:
1.
when you create a manual texture in while using DirectX 9Ex. If you create this texture with a TU_STATIC usage, the system automaticlly changes this to TU_DYNAMIC to prevent failure of lock crashes.
If someone can think of a better code for this let me know.
2.
FYI The reason I implemented DirectX 9Ex is because it's needed to support an NVidia API which allow rendering OpenGL content in DirectX and vice versa. See http://developer.download.nvidia.com/op ... nterop.txt for details
3.
to Wolfmanfx
Sorry if I mislead you about DirectX 9Ex. Turns out it's a very small change to the system, so you don't really need to create a whole new render system just for the 9Ex option. you can Piggyback on the regular DirectX 9 (accept for a couple of small changed its preaty much the same code)
it's turtles all the way down
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
-
- OGRE Retired Team Member
- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
Re: Added - DirectX 9Ex implementation
I erroneously added these commits to the trunk.
They are now transplanted in the v1-9 branch along with a small patch to improve memory consumption.
They are now transplanted in the v1-9 branch along with a small patch to improve memory consumption.
it's turtles all the way down
-
- Goblin
- Posts: 231
- Joined: Thu Feb 12, 2009 3:49 pm
- Location: France
- x 13
Re: Added - DirectX 9Ex implementation
I tried it just minutes ago, and I must say... It's not really great. With the option turned on, texture loading is slower, and FPS is around 80. With the option turned off, loading is much faster and I'm at around 125FPS.
Setup: i7 3770K, 8GB DDR3, GTX285, Windows 7 x64
Isn't it supposed to make things faster? :p
Setup: i7 3770K, 8GB DDR3, GTX285, Windows 7 x64
Isn't it supposed to make things faster? :p
-
- OGRE Retired Team Member
- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Added - DirectX 9Ex implementation
@Wolfmanfx - compare the two in full screen
Watch out for my OGRE related tweets here.
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Added - DirectX 9Ex implementation
So i tested it on my machine (Quad core / GeForce GTX 560 Ti ) in windowed mode with DirectX9EX it caps the framerate to 120 FPS in fullscreen mode there is a little framedrop from 10 fps so i think its ok.
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Added - DirectX 9Ex implementation
What is your monitor refresh rate? Is possibly v-sync is always on in windowed mode?
Watch out for my OGRE related tweets here.
-
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 100
Re: Added - DirectX 9Ex implementation
Refresh rate is 60Hz (i have two monitors attached)
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Added - DirectX 9Ex implementation
This may the reason for the performance issue:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Flip Mode Presentation of Direct3D 9Ex is an improved mode of presenting images in Direct3D 9Ex that efficiently hands off rendered images to Windows 7 Desktop Window Manager (DWM) for composition. Beginning in Windows Vista, DWM composes the entire Desktop. When DWM is enabled, windowed mode applications present their contents on the Desktop by using a method called Blt Mode Present to DWM (or Blt Model). With Blt Model, DWM maintains a copy of the Direct3D 9Ex rendered surface for Desktop composition. When the application updates, the new content is copied to the DWM surface through a blt. For applications that contain Direct3D and GDI content, the GDI data is also copied onto the DWM surface.
Watch out for my OGRE related tweets here.
-
- OGRE Retired Team Member
- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
Re: Added - DirectX 9Ex implementation
Haven't had the time to test it today but:
1. I remember when developing it I remembered that I turned on the directX9 log and it reported warning on creating resources on the texture pool that are not write only. The directX output warned that it might cause performance issues. At the time I dismissed it out of hand as I figured out it will be just like saving the data in the cpu which is what Ogre usually does.
2. I hadn't really run the sample in release mode it may also be that the new buffer flipping mechanism is not such a boon as advertised.
I'll check both things tommorow or the day after that.
1. I remember when developing it I remembered that I turned on the directX9 log and it reported warning on creating resources on the texture pool that are not write only. The directX output warned that it might cause performance issues. At the time I dismissed it out of hand as I figured out it will be just like saving the data in the cpu which is what Ogre usually does.
2. I hadn't really run the sample in release mode it may also be that the new buffer flipping mechanism is not such a boon as advertised.
I'll check both things tommorow or the day after that.
it's turtles all the way down
-
- OGRE Retired Team Member
- Posts: 260
- Joined: Tue Jan 01, 2008 11:28 am
- Location: Israel
- x 32
Re: Added - DirectX 9Ex implementation
The DirectX 9Ex implementation seems like a dud. It's important where I work because it allows to use an NVidia extension that render openGL textures on directX, but apart from that it doesn't seem to have any real benefits for Ogre, only disadvantages.
Changing the flipping mode as suggested by windows to D3DSWAPEFFECT_FLIPEX did not cause a framerate improvement. in fact framerate seamed much worse (I remove the "improvement").
The framerate overall of 9Ex is slightly lower then in simple d3d9. There is much less chance of device loss in 9Ex, but Ogre already has systems to take care of that anyway. Plus you loose the ability to use managed pools.
Changing the flipping mode as suggested by windows to D3DSWAPEFFECT_FLIPEX did not cause a framerate improvement. in fact framerate seamed much worse (I remove the "improvement").
The framerate overall of 9Ex is slightly lower then in simple d3d9. There is much less chance of device loss in 9Ex, but Ogre already has systems to take care of that anyway. Plus you loose the ability to use managed pools.
it's turtles all the way down
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: Added - DirectX 9Ex implementation
Yes, wglDXRegisterObjectNV - only works with DirectX 9Ex - else it returns NULL.
Watch out for my OGRE related tweets here.