Game Development Community

Performance Drop FPS demo

by Alienforce · in Torque X 2D · 12/08/2007 (6:19 am) · 10 replies

I have one strange issue i cant pin down.

On my dell M70 with nVidia Quadro FX1400 512mb
Everything runs without any problem

BUT! on my main dev machine with nVidia GeForce 7950 1gb
Everything runs ok, but when i look up the machine almost freezes or when i pass down thrue the terrain in the "terrain" demo

I have checked the gfx drivers and runtime DirectX etc and there is no diffrence between the machines.

I dont have any other issues with other XNA engines, TGE/TGEA etc...

I somehow feel its related to the skybox (strange i know ) will come back with more info later on.

#1
12/08/2007 (11:46 am)
Ok, Now i am lost...........

Add..
true
to "torqueSettings.xml" fixes the problem BUT HEY!!!

"Whether D3D fences should be simulated. Fences can improve performance on lower end video cards
that suffer when the game is rendering at a higher framerate than the card can handle. Default false."

I would not say my nVidia GeForce 7950 is a low end gfx card :)

More later.......
#2
12/08/2007 (1:47 pm)
There is definitely some sort of problem with rendering in the 1.5.0 release. A few of us have posted bugs about terrible performance on top end video cards, especially when the last release had no such problems. Something is definitely wrong here, but I can't pin it down. Here are some related threads...

www.garagegames.com/mg/forums/result.thread.php?qt=69850
www.garagegames.com/mg/forums/result.thread.php?qt=69944

John K.
#3
12/09/2007 (8:11 am)
Has anyone been able to find more information on these "D3D fences?"

I used to do DirectX/Direct3D programming and can't recall anything about them. I did find a reference to OpenGL fences which are some kind of barrier that forces some of the calls made to the API to complete before resuming execution. So it's a sort of blocking call. But I'm not sure what the D3D fence is.
#4
12/09/2007 (11:05 am)
Kzoink, I really have no idea what fences refer to either. All I know, from a closer look at the code and some testing, is that the following code must be in my TorqueEngineComponent.OnEndDraw() method:

GraphicsDevice graphics = GFXDevice.Instance.Device;
if (myTexture == null)
{
    myTexture = new Texture2D(graphics, graphics.DepthStencilBuffer.Width,
        graphics.DepthStencilBuffer.Height, 1, ResourceUsage.ResolveTarget,
        SurfaceFormat.Bgr32, ResourceManagementMode.Manual);
}
[b]graphics.ResolveBackBuffer(myTexture);[/b]

Without the ResolveBackBuffer call, my high-end computer grinds to a slow down. As far as I can tell, you have to resolve the rendertarget from the backbuffer since the backbuffer serves as the default rendertarget used when there isn't a custom one. So, I'm guessing that if you render the scene with a custom rendertarget, you won't need to set the SimulateFences flag at all - but still need to test that idea.

John K.
#5
12/26/2007 (3:41 am)
Can you post the entire endDraw function so I can paste it in?
#6
12/29/2007 (9:33 am)
Okay, an interesting update. Setting true is not the only way to improve performance. You can also....

1. Set true in the torqueSettings.xml file

OR

2. Set a valid PostProcessor to the GuiSceneView (sceneView.PostProcessor=MyPostProcessor)

OR

3. Add a scene object to your 2D scene that uses the LightingMaterial and add a light or two to the scene.

So, what does all this mean? Actually, I don't know. But it seems like it has something to do with the shader rendering. Maybe our 'slow rendering' computers are stuck in a fixed-function pipeline mode and needs something (like the above methods) to 'kick' the GPU into Shader mode. Anyway, if there are any GPU experts reading along, please chime in. I don't even mind the slow performance as much as the choppy looking graphics.

www.envygames.com/share/strange1.jpg
John K.
#7
01/09/2008 (6:28 am)
I got rid of the jaggy edges on the rendered textures in de 1.5.0.0 Torque X Pro 3D version by
changing the default rendering effect (file : TorqueEngineData/effects/SimpleEffect.fx)

using the baseTexTureSampler in function CopyPS in stead of the
CopyTextureSampler

float4 CopyPS(VSOutput input) : COLOR
{
    float4 color = tex2D(CopyTextureSampler, input.texCoord);
    color.a = opacity;
    return color;
}

xna.ruach-interactive.com/images/torque-engine/issues/texture-edges-before.gif
changed to

float4 CopyPS(VSOutput input) : COLOR
{
    float4 color = tex2D(baseTextureSampler, input.texCoord);
    color.a = opacity;
    return color;
}

xna.ruach-interactive.com/images/torque-engine/issues/texture-edges-after.gif
dunno if this will lead to other (performance) problems but maybe it is helpful.

Martijn Segers
#8
01/09/2008 (8:52 am)
This is great Martjin!!! This definitely resolves my complaint about the pixelation. I'll have to run some tests to see the performance impact. Thank you and good job!!!

John K.
#9
01/11/2008 (6:44 am)
John,

can you plz let me know about yr test results?
#10
02/25/2008 (10:20 pm)
Hey everyone,

I just started a new project from scratch and hit the performance bug. What I did was create a new project, then rename the default namespace to something else. I changed the project's Application properties to use MyNamespace.Main as its startup object.

It seems like true only fixed the framerate if renamed the default namespace BACK to StarterGame2D.

Am I missing something obvious here?

By the way, the modified shader function by Martijn works great. Thanks!