|
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:
34 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
|
Re: Direct3D 10/11 & Direct2D in WPF
Where Can I Find a Rating on Which replica Christian LouboutinShoes Are the Best From the Rest? Discover Why Marc Jacobs Handbags Are Of The Highest Quality. Where to Buy Wholesale Prada Handbags? Roberto Cavalli Handbagsis a designer whose pieces are instantly recognizable. Where to Buy the Best cheap led online. Here are the world's bestwholesale led lights. Who Wore Christian Louboutin Pumpsat the Grammy Awards This Year? Comfortable and Fashionable Men's winter boots. replica Tiffany Can Make One Always Feel Special. Here are the lowestcheap abercrombie. UGG Australia Womens Highkoo Are the Perfect Ones. UGG Australia Sundance II For Everyone. Find Luxurious Casual Wear at theAbercrombie Men Jeans. Find Luxurious Casual Wear at theAbercrombie Women Jeans. Tiffany & Co. Accessories - The Emphasis is on Style. Tiffany & Co. Pendants is Becoming a New Favorite For Women.
By wds on
3/12/2010 5:06 PM
|
Re: Direct3D 10/11 & Direct2D in WPF
Center For Biological Diversity Plans To Use Polar Bears Nike Dunk Low To Shut Down Domestic Energy Production“We have clearly seen that one of the major problems is with the Act itself - it gives bureaucrats enormous authority to render Nike Dunk Higharbitrary decisions that are not based on sound, accepted scientific and forecasting principles.“It’s important to also examine the motives of the group that petitioned for the listing the Center for Biological Diversity. The Nike Air Force 1Center has not hidden its agenda, which is to impose price controls and energy rationing on hard working Americans. The authors of the polar bear petition outlined these goals very clearly in their published articles on the issue. They include finding a federal judge to: - Increase mileage standards for autos Air Force 1 Shoesand trucks beyond that which Congress decides; - End all offshore oil and gas leasing in the entire United States Outer Continental Shelf; - Shut down new coal-fired power plants; - Kill oil shale leasing; - Stop limestone mines for cement manufacturing; - And endeavor to stop ‘dozens, perhaps hundreds, of other projects […] individually and “Does this sound far-fetched? SB DunksNot where the San Francisco-based Ninth Circuit is concerned. The Center has indicated its ‘test’ for imposing energy rationing will be performed in the liberal Ninth Circuit, which has an overwhelming majority of its decisions overturned when heard by the U.S. Supreme Court.”From Gov. Sarah Palin:Polar Bear Listed as Threatened;Governor Pledges to Work for ConservationMay 14, 2008, Anchorage, Alaska – The U.S. Fish and Wildlife Service (USFWS) announced its decision today to list the polar bear as threatened under the Endangered Species Act. U.S. Department of Interior Secretary Dirk Kempthorne called Governor SarahNike Dunks Low Palin this morning to inform her of the USFWS decision, and assured her that oil and gas developments are not to blame. The state will work with the USFWS on the designation of critical habitat and development of any conservation actions that may be necessary to ensure the continued viability of the species.While theNike Dunks High state is disappointed with this decision, Governor Palin said, the state stands ready to assist the USFWS to ensure that polar bear populations remain viable for decades to come. “We offer the substantial expertise of the Alaska Department of Fish and Game to assist in the protection of polar bears, and in minimizing negative impacts on the people of Alaska and on important activities elsewhere in the country,” she said.“Alaskans take our public trust responsibilities for our resources very seriously, and we welcome the opportunity to work with the federal agencies to address the conservation needs of these magnificent animals,” Governor Palin said. "We will continue to take the steps necessary to ensure that polar bears continue to thrive for generations to come.”
By dfh on
3/12/2010 9:30 PM
|
|
|
twelvesky2 Gold
12sky2 Gold in which world have one feature. First of all, realize the twelve sky2 Gold is useful to the each new player. You only play with others and Twelvesky2 Gold can get happy from the game
By cheap twelve sky2 Gold on
3/15/2010 5:54 PM
|
ed hardy
ED Hardy Hoodies ED Hardy Hoodies Ed Hardy Swimwear Ed Hardy Swimwear ed hardy tops ed hardy tops ed hardy shoes ed hardy shoes ed hardy t shirt ed hardy t shirt ed hardy shirts ed hardy shirts christian audigier christian audigier ed hardy kids ed hardy kids Ed Hardy Sunglasses Ed Hardy Sunglasses ED Hardy belts ED Hardy belts ed hardy Bags ed hardy Bags ed hardy purse ed hardy purse ed hardy mens ed hardy mens ed hardy womens d hardy womens ed hardy mens shirts ed hardy mens shirts ed hardy mens tops ed hardy mens tops ed hardy mens hoodies d hardy mens hoodies ed hardy mens swim trunks ed hardy mens swim trunks ed hardy mens shoes ed hardy mens shoes ed hardy womens swimwear ed hardy womens swimwear ed hardy womens t shirt ed hardy womens t shirt ed hardy womens tops ed hardy womens tops ed hardy womens pants ed hardy womens pants ed hardy womens hoodies ed hardy womens hoodies ed hardy womens shoes ed hardy womens shoes ed hardy womens clothing ed hardy womens clothing
By ed hardy on
3/15/2010 9:29 PM
|
cheap nike shox
There are wide variety of Nike Shox for both men and women's selection.The Nike Shox Sale are best selling nowadays.Get your own Cheap Nike Shox now.It's definitely time for you to buy womens nike shox and wens nike shox, Wearing them will keep you in a perfect condition.
By nike shox on
3/16/2010 10:25 PM
|
I more or less agree with you. <br>[url=http://www.vipuggstores.com/]classic ugg boots[/url] have become very popular among women and men all over the world. As a fashion statement, <br>[url=http://www.vipuggstores.com/ugg-5818-classic-tall
I more or less agree with you. [url=http://www.vipuggstores.com/]classic ugg boots[/url] have become very popular among women and men all over the world. As a fashion statement, [url=http://www.vipuggstores.com/ugg-5818-classic-tall-boots.html ]ugg boots uk[/url] is a great choice for people who want to give their boots an edge.
you have my vote. [url=http://www.chiflatiron4u.com]chi flat iron[/url] is the Best For Hair Straightening and it will make your hair most good-looking and you will be high-handed of.
Oh, I agree with you. A [url=http://www.topghdmart.com]ghd hair iron[/url] Can Make It Easy To Style Your Hair. [url=http://www.topghdmart.com/special-ghd-hair-iron/ghd-kiss-pink-mk-iv-hair-straightener-and-lip-glosses-set-limited-edition-for-2008.html ]ghd hair straightener[/url] will make your hair get it looking its best.
By ugg boots sale on
3/16/2010 11:44 PM
|
|
Re: Direct3D 10/11 & Direct2D in WPF
This article is very interesting, I like it. I will always come to visit after.I would recommend to friends more. mbt shoes Collection in MBT Kisumu Sandals, MBT Sport Shoes, mbt walking shoes, MBT Shuguli GTX and MBT Fanaka GTX Shoes and so on. They are very popular in USA, UK, Canada, mbt walking shoesAustralia, France, Germany, discount mbt shoes Swiss and now China. You will never worry about how to go with your mbt shoes, because they collect all the colors in Beige, Cream, Coffee, Chocolate, Blue, Birch, Chili and Pink, White, Black, Red, Silver and Grey just like the Rainbow.
By bhreah on
9/26/2010 12:04 AM
|
|
|
|