• 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

Flicker in Direct3D9 video

2 posts in this topic

My application needs to capture and play a live video stream from an Epix imaging board hooked up to a camera. I use an unmanaged Direct3D9 device, with a vertex shader and pixel shader associated to an Effect.


In my development box, I emulate the imaging board by loading a video from a file into memory and launching a thread which supplies frame by frame to the application when requested. This works and looks great in my development box (Windows 7 x64, two monitors, each one hooked up to a NVIDIA GeForce 210 - two monitor, two video cards).


In our production box, however, the live capture exhibits a quite noticeable flicker. The production box has ONE NVidia GeForce 210 card which two outputs hooked to two monitors. Asides from that, hardware specs are a little below the development box (Dev has an i7 CPU, 4 GB RAM and Win7 x64, while Prod has an Intel G2020 with 2 GB RAM and Win XP x86).


I tried installing and running PIX in Prod, but it crashes when I exit my app. I tried all configurations I could think of but couldn't capture a single frame. First of all, I want to ascertain if this is really a performance issue. If it is so, I'd struggle with PIX or try nvPerfHUD to determine if the app is CPU or GPU bound.


But I'm at a loss now. How could I see if this is really a performance problem, or maybe I'm messing up some property in my Direct3D9 device?


// Set up the structure used to create the D3DDevice. We will create a
// device with a zbuffer.
ZeroMemory( &m_d3dpp, sizeof( m_d3dpp ) );
m_d3dpp.Windowed = TRUE;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
m_d3dpp.EnableAutoDepthStencil = TRUE; // Let Direct3D create and manage z-buffer
m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

The camera is capturing at 25 FPS. My simulator works as fast as the CPU lets it, and in my dev box it runs at almost 60 FPS.


Edit: I render my images as textured quads; texture size is configurable. If an image is larger than the texture size, more than one quad will be needed.


Edit2: My application uses Windows Forms for its GUI, and the direct3d part is done as a C++/CLI class which inherits System.Windows.UserControl and wraps an unmanaged class which does the actual rendering. But I managed to make a smaller, all unmanaged test which reproduces the problem. I used plain WinAPI to render inside a window created with the CreateWindowEx function. And it still flickers...

Edited by dario_ramos

Share this post

Link to post
Share on other sites

I got PIX working now; my test crashed on exit and it seems that messed up PIX's sampling. So now I'm learning how to profile and analyze the results properly, since I only used PIX's "Debug this pixel" feature before. I'll get back with results later.


Share this post

Link to post
Share on other sites

OK, I ran PIX and here are some results. First, I selected "Statistics for each frame, using counterset" with a custom counter set which displayed FPS and %Processor Time. I got this:



Yellow is %Processor Time, red is FPS. So if I understand correctly, virtually all of the frame time is consumed by the CPU. On the other hand, FPS oscillates wildly between 60 and below 25. That seems consistent with the flicker I experience (it doesn't happen all the time; it fluctuates).

Then I closed the test program and looked at the timeline:




So it would seem I'm CPU bound, which seems to be consistent with %Processor Time being at 100%.

First of all, is my analysis correct? Second, why does FPS vary so wildly? And then, how should I go about looking further into this? I thought of enabling draw timing and looking at a frame where instantaneous FPS is low, to see which calls consume more time.


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