[SlimDX] How to speed up my engine?

Started by
3 comments, last by BradDaBug 13 years, 8 months ago
I've been working on a viewer/remake-of-the-engine for Gabriel Knight 3, but I'm having some serious performance issues, especially with the Direct3D 9 renderer, especially on this Intel integrated chip inside this laptop. I wouldn't really be worried about this, except that the original GK3 runs beautifully on this laptop. I want my engine to run as close to the performance of the original game as possible.

I've been using SlimTune to profile the engine, and it looks like over 45% of the time is spent inside Device.DrawPrimitives(). Another 10% is inside Direct3D9Effect.SetParameter() (when I set my texture parameters, specifically), and another 7% inside Direct3D9Effect.CommitParams().

Is there anything I can do? The only thing I can think of is to somehow reduce the number of DrawPrimitive() calls, but I'm already doing basic frustum culling.
I like the DARK layout!
Advertisement
You can probably reduce your draw calls much further. How many are you making per-frame? GTK was a 2D game, wasn't it? Most of your primitives can probably be chunked into a handful of calls. What's the granularity of a draw call in your codebase (i.e. how many sprites are you drawing per call)?
No, it's 3D.

I don't really know how I could batch my draw calls any further. The main thing taking so much time is rendering the room geometry. It's made up of lots of little surfaces, and each surface has its own combination of texture and lightmap, so I have to be able to render each surface separately so I can set those textures (right?).
I like the DARK layout!
Quote:
so I have to be able to render each surface separately so I can set those textures (right?).

You may want to combine the textures into a larger texture atlas, that way you will not have to have so many texture switches and distinct draw calls.
I found this and implemented it, and it seems plenty fast enough to use at run time. And even though all I've done so far is change my code to set the lightmap texture parameter just once instead of again and again for each surface I'm already seeing something close to a 2x speed increase.

I'm putting a 1 pixel gutter around each lightmap inside the atlas, and sometimes it's possible to see it. I guess I need a bigger gutter.

But anyway, thanks!
I like the DARK layout!

This topic is closed to new replies.

Advertisement