• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MyMikeD

Shared surfaces with WPF and SlimDX

3 posts in this topic

Hi,

Our application is using Shared Surfaces to interop between Direct3D10 and WPF (using d3dimage). Basically the concept is to created a shared Direct3D9 surface that is attached to the d3dimage and then have Direct3D10 render to that shared Direct3D9 surface. There is an SlimDX example that does this as well. We use the code from the example in our application.

We have been finding some strange drawing anomalies using this technique on some cards. Basically it looks like the image is only partially rendered. My current theory is that this is because of synchronization issues between the shared surfaces. I stumbled upon this article and info about synchronization [url="http://archive.msdn.microsoft.com/D3D9ExDXGISharedSurf"]http://archive.msdn.microsoft.com/D3D9ExDXGISharedSurf[/url] From what I can tell the SlimDX code for doing this shared surface stuff to WPF doesn't have any of this type of stuff in it. Should it?

Also is any of the queue functionality described in this D3D9ExDGIISharedSurf API (ie ISurfaceQueue, ISurfaceProducer, ISurfaceConsumer) exposed via SlimDX?

Thanks,

Mike
0

Share this post


Link to post
Share on other sites
Found this thread after I had posted [url="http://www.gamedev.net/topic/606138-slimdx-issues-with-keyedmutex-and-wpf/"]http://www.gamedev.net/topic/606138-slimdx-issues-with-keyedmutex-and-wpf/[/url] I'm going to try the "staging resource" technique for synchronizing and see if that fixes the problem. Will post the results!
0

Share this post


Link to post
Share on other sites
Hello MyMikeD,

Are you using the D3DImage as explained in this article: [url="http://www.codeproject.com/Articles/28526/Introduction-to-D3DImage"]Introduction to D3DImage[/url]? I have also tried it before and it worked for me. In the end, getting WPF and SlimDX (or SharpDX) to work together is some narly business. I never actually got them to work together in the way I wanted (WPF dynamic framerate controlled my own framerate). In the end I dropped it all together and just did it myself with SlimDX.

In case you can't get it to work, there is also the option of using an overlaying WPF windows on top of your 'Render'-window (which can be native). By making the WPF window transparent, borderless and on top, it will appear to be merged with render-window. That way you can let the Render-window render on a desirable 60 Hz frame rate and WPF performs in its own terms.
Desktop Windows Manager (DWM) takes care of the rest for you, only during resizing the render window the user might see some black borders as artifacts, but if that doesn't matter to you, you are set.
0

Share this post


Link to post
Share on other sites
Yes we are using d3dImage to render the Direct3D 10 scene via a shared texture... there is also some Direct2D stuff mixed in there as well. So it's a bit of a complicated scenario with making use of shared surfaces.

Turns out that yes indeed it was a synchronization issue. The different results I had on different cards was a result of how fast the card could render my scene. If it could render it fast enough before extracting it to the d3dImage then I was fine, if not then stuff was dropped. This article describes the issues and the solutions http://archive.msdn.microsoft.com/D3D9ExDXGISharedSurf

All I had to do was the "mapping staging texture" trick (my case I'm not worried about multiple threads) and voila things seem to be synchronized now fine on all cards.

Below is the piece of slimDX code I used (I'm using D3D10) to synchronize after rendering my D3D10 scene :


[CODE]
const int subResourceNumber = 0;
ResourceRegion resourceRegion = new ResourceRegion { Back = 1, Bottom = _stagingTexture.Description.Height, Front = 0, Left = 0, Right = _stagingTexture.Description.Width, Top = 0 };
_device.CopySubresourceRegion(_renderTexture, subResourceNumber, resourceRegion, _stagingTexture, subResourceNumber, 0, 0, 0);
_stagingTexture.Map(subResourceNumber, MapMode.Read, MapFlags.None);
_stagingTexture.Unmap(subResourceNumber);
[/CODE]
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0