|
Nov
27
Written by:
Jeremiah Morrill
11/27/2009 11:22 AM
For a while, I’ve wanted to tackle getting the newest Direct3D technologies to interop with WPF. Direct3D 10/11 and Direct2D all have very cool usage scenarios that are just impossible with the WPF API. So far the only solutions I have seen to interop WPF and it’s cousin D3D technologies was to use hWnd interop. If you gotta have airspace restrictions, why even bother? Nobody really wants a hot, steamy, always-on-top hWnd hovering over their super cool WPF interface. So how do we render D3D10/11 and D2D into WPF w/o airspace issues? We only have a D3DImage class that supports Direct3D9. Well the fine people of the WPF team informed me that a IDirect3DDevice9Ex, which is the recommended device to use with D3DImage in Vista/7, supports sharing resources between devices (and processes too if you care). We can create a shared render target on Direct3D10/11, then pull it in via an intermediate IDirect3DDevice9Ex device. No copying required! This resource we pull into 9Ex, can then be sent to the D3DImage for high performance rendering. I have not benchmarked anything, but just eyeing CPU performance, it does not seem to have any extra overhead in sharing the resources. Performance seems to be similar (if not the same) to using D3DImage with 9Ex and unshared surfaces. I’ve created a D3DImage subclass to add support for D3D 10/11 render targets (Texture2D). Usage is simple: 1: /* Set the back buffer, which is a ID3D10Texture2D pointer */ 2: m_d3DImageEx.SetBackBufferEx(D3DResourceTypeEx.ID3D10Texture2D, pRenderTarget);
One caveat is the D3D 10/11 render targets must be created as D3D10_RESOURCE_MISC_SHARED. The other caveat is I don’t handle lost devices (which only happens in a few situations with 9Ex, like driver being upgraded) just yet so I don’t recommend using this in production at the moment.
Also the D3D10 scene code is very sloppy and was pieced together from other samples. It’s also in C++, but I’ll do some managed examples later on.
To compile make sure you have the latest DirectX SDK and Windows SDK!
Tags:
24 comment(s) so far...
Re: Direct3D 10/11 & Direct2D in WPF
Hi, I tried to use your code but i get an exception (0x80070057) for the method 'CreateTexture2D'. I don't know why the param "DXGI_FORMAT_B8G8R8A8_UNORM" isn't support. I have Vista SP2 DirectX 11
By romain on
12/6/2009 6:19 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
Did you install the sdks listed above? I think you also need the dx11 for vista addon
By Jeremiah Morrill on
12/6/2009 12:53 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
try DXGI_FORMAT_R8G8B8A8_UNORM RGBA insted of BGRA
By alive on
12/15/2009 7:09 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
To find the material in pdf format quickly with the help of PDF Search engine is easy. This SE www.pdfqueen.com is my favorite.
By Hailee on
12/16/2009 4:47 AM
|
Tried Direct2D
Thank you Jeremiah, your intuition did throw some light in the very confused world of MS APIs... What about Direct2D, have you succedeed in getting rendered some content and pulling it using the same method? Thank you, Stefano
By Stefano Baraldi on
12/30/2009 2:31 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
I love this article , Very good collection of information
By Replica Louis Vuitton Handbags on
1/5/2010 10:53 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
The author's writing is sharp, statement, smooth, people admire.ugg boots sale,ugg boots,uggs sale;there have other ugg boots sale,ugg boots,gucci shoes,gucci handbags,mbt shoes,cheap mbt shoes.thank you very much.
By chi flat iron on
1/30/2010 12:43 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
I loved the editorial.It is very interesting.Thank you for the information.ugg boots sale|uggs|uggs sale|cheap mbt shoes|mbt shoes|nike air max|gucci shoes|air jordan shoes online payday advance.
By ugg boots sale on
2/5/2010 9:06 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
I'm getting an exception, trying to create a SharedHandle for DX11 Surface. Is there any workarounds rof this issue?
By TarmoRhox on
2/16/2010 1:06 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
There are hundreds of stores from where you can buy your own pair of Air Jordan Shoes. While these are offered at malls, you can also choose to get your own through online apparel stores.
By Nike Air Jordan on
2/24/2010 6:28 PM
|
cheap shoes
lighting designer Adam Silverman. Paul Steinberg's corrugated metal sets are fine, wholesale jordan shoes even though the first act wholesale jordan shoes looks an awful lot like the first act set for Alden's recent wholesale nike shoes ENO Jenfa. wholesale jordan shoes Grime's precariously perched, too tidy hut is particularly handsome, and the act two beach scene wholesale jordan shoes is beautiful in wholesale jordan shoes an Edward Hopperish fashion
By jordan shoes on
2/25/2010 6:33 PM
|
|
|
Re: Direct3D 10/11 & Direct2D in WPF
Do you want cheap Maple Story meso, EverQuest 2 gold, eve online isk and WOW CD Keys or World of Warcraft CD Key, EverQuest2 CD Key? Star Trek Online is the new released game. watch star trek online and runescape gold in our store. RS2 Gold, Maple Story meso or maple Story mesos, EverQuest 2 gold, eq2 plat, eve online isk with low price is offered to you now. Buy WoW Game Cards. Buy WOW CD Key and EverQuest2 CD Key, Star Trek Online from questmonk now. You can watch star trek online wonderful gold in our store. And Runescape gold? Also, with maplestory meso or Maple Story meso, eq2 plat, everquest 2 gold, eve online isk, RS gold is warmly welcomed. WOW CD Keys or World of Warcraft CD Key, EverQuest2 CD Key are popular. What’s more, we give the help of wow power leveling. The wow leveling in our store is professional. The new Star Trek Online gold is available. watch star trek online in Forvault. Star Trek Online is a good game. You also can watch star trek online gold in Gogoer.fr. Star Trek Online gold and watch star trek online is wonderful for you. Buy Star Trek Online gold now. watch star trek online. In addition, cheap powerleveling and other Power leveling is good. gold power leveling, leveling guide everquest 2 comes to you. Come on!
By xiexie on
3/6/2010 3:44 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
There is a place for you to buy metin2 moneyandguild wars gold. And this is the big online store that can offer you Guild Wars CD Keys anddarkfall gold. You can get cheapdfo gold, cheap ffxi gil, lineage 1 gold, Star Wars Galaxies Game Cardherehellgate london cd keyand so on. As is known to all that pc game cd key play an very important role in the MMORPG. For example, you can getTabula Rasa CD Key to start your game. Also, you can get Vanguard cd key to start your Vanguard cd key. Many players know that metin2 and metin2 gold plays an very important role in the game. So it is withguild wars armor. There is a new game that need cheap dfo gold too. And daoc gold is here for you. You can buy darkfall, cheap ffxi gil, lineage 1 gold, andLOTR Gold. The gameguild wars is a famous game at the present. Like in other games, metin2 money andGuild Wars CD Keys play an very important role in the games. You should know Warhammer, not a very famous game, needsWarhammer CD Key to activate the game. We are one of the leading online stores dealing indfo gold, cheap dfo gold, anddarkfall gold. We also deal incity of heroes power leveling, city of villains leveling, EverQuest 2 leveling, FFXI CD Key, Age of Conan Cd key, Lord of The Rings Online CD Key, Star Wars Galaxies CD Key, Hellgate London CD Key, andPC Game CD Keys. Join us and get your gamehappier. Your coming will be highly appreciated.Tabula Rasa CD Key Vanguard cd key,lotr gold
By xiexie on
3/6/2010 3:45 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
world of warcraft gold,wow gold kaufen, wow power leveling in our store is nice. world of warcraft gold and wow power leveling is cheaper. To buy wow gold and world of warcraft gold is a good choice. Thebest wow gold, wow powerleveling, and maple story mesos is offered. maplestory mesos is the best.wow cd keys, World of warcraft Prepaid Card are nice. dofus kamas,kamas dofus are given to you. EQ2 Time Cards, Guild Wars CD key with low price comes to you. runescape2 money, in Rs2bag is the cheap runescape2 gold. Guild wars gold or Guild Wars Money, everquest2 platinum or Eq2 goldare perfect. runescape money or runescape gold, and Warhammer goldin tbcgold are also very cheap. eq2 gold,flyff penya,eq2 plat are wonderful. In addition, company of heroes cd key, City of Villains CD key welcome you to get. COH Influences, or City Of Heroes Influenc and City of villains infamy or Cov infamy will make you feel happy in our stores!
By xiexie on
3/6/2010 3:46 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
Cheapwow goldis offered to you. Find cheapwow gold and wonderful wow gold in our store. Buy the wow gold in Farvault for you. wow gold we provide is very nice and you will have a nice game journey with the wow gold.
By xiexie on
3/6/2010 3:47 AM
|
|
|
Re: Direct3D 10/11 & Direct2D in WPF
Christian Louboutin Shoes are designed for women who crave for fashion. Whether you want to find trend shoes out for dating or shoes for holiday, Christian Louboutin shoes can satisfy you.
By Christian Louboutin on
3/8/2010 10:34 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
I agree with you, there are some things that you would love: gucci shoes gucci handbags gucci shoes for men jordan shoes cheap jordan shoes air jordans
By uggs sale on
3/10/2010 9:46 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
Well in this situation farming for the jordan dmp can only be made easy if Discount UGG Boots jordan dmp saleyou have right World of Warcraft tools in your hand. One of the options open before you is to.
By www.discountjordanshoes.com on
3/11/2010 12:29 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
Well in this situation farming for the jordan dmp can only be made easy if Discount UGG Boots jordan dmp saleyou have right World of Warcraft tools in your hand. One of the options open before you is to.
By www.discountjordanshoes.com on
3/11/2010 12:30 AM
|
www.discountjordanshoes.com
Well in this situation farming for the jordan dmp can only be made easy if Discount UGG Boots jordan dmp saleyou have right World of Warcraft tools in your hand. One of the options open before you is to.
By www.discountjordanshoes.com on
3/11/2010 12:33 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
thank you for your great post, and I did want to share this. I hope you will also like it, if you think it is spamming, please kindly delete it. thank you!abercrombie see what is this? abercrombie and fitch uk abercrombie and fitch abercrombie fitch uk abercrombie mens abercrombie london
By abercrombie on
3/11/2010 6:51 AM
|
Re: Direct3D 10/11 & Direct2D in WPF
Hi,
Do you have a completly managed C# sample of the above code yet by any chance,
Thanks,
WArd
By Ward on
3/11/2010 8:55 AM
|
|
|
|