|
Dec
6
Written by:
Jeremiah Morrill
12/6/2009 12:21 AM
This one isn’t for the faint of heart, but if you are a Direct3D guru and always wanted some more low level access…here is a good start. This hack does a overwrites IDirect3DSwapChain9::Present method in memory to hook into the call WPF makes. In that hook, I also pull out the IDirect3DDevice9 pointer. What can we do with this? Well for one, it would be possible to render WPF to a texture in a Direct3D scene. You can also fiddle with the WPF rendering process. And if you are really tricky, you can probably even do something even more amazing. Given the time, I’d like to make a few examples, but for now, here is what I got. You need the DX and Winders SDKs
Tags:
10 comment(s) so far...
Re: How to get access to WPF’s internal Direct3D guts
I love this article , Very good collection of information,thanks.
By replica fendi scarf on on
1/5/2010 11:47 PM
|
Re: How to get access to WPF’s internal Direct3D guts
百度 [url=http://www.sina.com]sina[/url] [url="http://www.baidu.com"]baidu[/url] [url=www.google.com]google[/url] [link=http://www.yahoo.com]yahoo[/link] [a/]http://www.yahoo.com[a]yahoo[/a]
By chi flat iron on
1/30/2010 12:40 AM
|
Re: How to get access to WPF’s internal Direct3D guts
Very grateful to God, so I saw this article, let me learn a lot.ugg boots saleonline,cheap ugg bootsanduggs,Feeling very excited:ugg boots sale|gucci shoes|gucci handbags|mbt shoes|cheap mbt shoes.Welcome to our site,thank you.
By chi flat iron on
1/30/2010 12:41 AM
|
Replica scarf
aqian100208 Cheap Wholesale Designer Sunglasses|Replica Sunglasses| Wholesale Women Fashion scarves|Replica Scarf| replica hermes birkin and kelly handbagsHermes Handbags|
By ReplicaScarf on
2/7/2010 6:39 PM
|
Re: How to get access to WPF’s internal Direct3D guts
Do you know if this would make it possible to render wpf content out to a directshow playout device like the DeckLink playout cards? could this be used to call GetRenderTargetData on a wpf window?
By stewart johnson on
2/17/2010 9:21 AM
|
gucci shoes
if you want to buy here is some good Website for another you can see this any more jordan shoes air jordan shoes michael jordan shoes
By gucci shoes on
2/23/2010 10:17 PM
|
Re: How to get access to WPF’s internal Direct3D guts
This is the best thing I've ever seen, Jer! I converted the C++ implementation to C#, works fine: sichbo.ca/Files/WpfHack2.rar
Next up I'm going to see if we can't fix this god forsaken framerate problem rhnatiuk.wordpress.com/2008/12/21/wpf-video-playback-problems/) and write a proper video presenter once and for all. Now that we have an IDirect3DDevice9 handle, I'm hoping we can push through strict 40ms Present() timings with a DirtyRect of the video texture. Also hopefully avoid the "washed out" video texture that we get from the regular MediaElement.
- Simon
By Sichbo on
2/24/2010 7:02 PM
|
Re: How to get access to WPF’s internal Direct3D guts
So I've been toying with trying to make a video presenter which does a StretchRect() of the WPF surface scene ontop of a beautiful and flawless looking FULL FRAMERATE VMR9 d3d scene. Comparing WPF and this other d3d scene side by side you really appreciate just how choppy (rubbish) WPF video presentation really is.. anyway here are the issues;
1. WPF will never give you a "transparent" surface. Obviously the first call in the WPF Present() method is going to be Device->Clear(..,WindowColour,..); This means the plan for a nice alphablend overlay is dead in the water, because the swap chain backbuffer is always going to be a solid colour. If you set WindowStyle="None" AllowsTransparency="True", our vTable swap chain hack no longer works, I think because probably there is an additional swap chain added to the graph in this scenario.
2. When you make a second device and try StretchRect() the WPF surface directly, you get errors because we're not allowed to share surfaces between devices (unless you use newer dx10 surface sharing features which is not really suitable/worth it given most folks will be running the app on XP.)
3. On account of problem #2, this means we have to do a nasty and resource-intensive surface copy into the "SYSTEMMEM" pool. +30% hit right here.
4. The other obvious approach is to be injecting your own scene rendering into WPFs device - but it's not working out so great. You end up just flickering the screen since WPF will clear your drawing if you're trying to draw underneath it. So then I tried to "hook" the WPF Device->Clear(..) function pointer, and do the work in here. That sort of almost works in that I'm able to clear the background with my own colour, but if you try do anything fancy like SetTexture and draw a video quad, WPF clears it still, probably because it's present function is only doing a small "dirty region". But either way, all of that effort to hook into the wpf scene graph is going to be moot because we're once again rendering with WPF's crappy Present() intervals. Invoking the wpf's Present() continually I think will kill performance similar to the whole systemmem surface copy issue.
Bit bored now, think I'll give up.
- Simon
By Sichbo on
2/28/2010 11:21 AM
|
|
|
Re: How to get access to WPF’s internal Direct3D guts
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:52 AM
|
|
|
|