Jump to content
  • Advertisement
Sign in to follow this  
feal87

[SlimDX] Draw time different between same complexity meshes..

This topic is 3403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm drawing 3 meshes (24 vertices the first, 288 vertices the second, 24 vertices the third) one after another with DrawIndexedInstanced/DrawIndexedPrimitives with DirectX9 and DirectX10. (Please note that the 3 meshes are drawed in the same identical way) Why am i getting less than 0,50 ms (tested with Stopwatch in c# on the single line DrawIndexedPrimitives/DrawIndexedInstanced) for each mesh in DirectX9, but in DirectX10 i get First Mesh) 6,10 ms (1 instances) Second Mesh) 0,49 ms (1 instances) Third Mesh) 0,04 ms (120 instances) Why the first mesh, only 24 vertices takes all this time to render? (it has only 1 instance though...) (Please note that the meshes are all OPTIMIZED with the related function (even thought i use raw vertexbuffer/indexbuffer to draw)) Any clue? (All the vertexbuffer are created with DYNAMIC as usage) [Edited by - feal87 on April 20, 2009 4:12:31 PM]

Share this post


Link to post
Share on other sites
Advertisement
it seems that the time that the draw take differs depending on the order of the draw...
Am i doing the misuration wrongly? I thought the StopWatch was the best way to measure performance in c#...or maybe the order of drawing to impact on performance? (but why on DirectX9 it doesn't matter?)

Second Mesh) 5,936 ms (1 instances)
First Mesh) 0,4984 ms (1 instances)
Third Mesh) 0,0448 ms (120 instances)

Third Mesh) 0,0527 ms (120 instances)
Second Mesh) 1,4405 ms (1 instances)
First Mesh) 0,4512 ms (1 instances)

Second Mesh) 0,4483 ms (1 instances)
Third Mesh) 0,0453 ms (120 instances)
First Mesh) 1,4546 ms (1 instances)

I really don't know...

Share this post


Link to post
Share on other sites
I've read the whole document and i tried to do a profiling of the whole scene to avoid the command buffer.

The whole scene takes without the present (regardless of the order of drawing) :

0.58 ms on DirectX9
8,01 ms on DirectX10

with the SAME shader, same mesh, same method to draw.
Tried to remove the 3D Objects and got :

0,37 ms on DirectX9
0,40 ms on DirectX10

There has to be some problems...i'll try to investigate...

Share this post


Link to post
Share on other sites
Could this be a Driver problem? My only DX10 enabled video card is the Intel X3100 integrated. I've tried with pix to check the time spent on

Draw*
DrawPrimitive
DrawIndexedPrimitive

In DX9 mode it gives all the time on DrawIndexedPrimitive (i'm drawing only them after all), in DX10 mode it gives only DrawPrimitive even thought i'm drawing ONLY indexed primitives...
Is this a normal behaviour for Pix in DX10?

Here's my draw code for DX10 :


device.InputAssembler.SetInputLayout(_layout);
device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding[]
{
new VertexBufferBinding(_meshVertexBuffer, 56, 0),
new VertexBufferBinding(_instancesVertexBuffer, 52,0)
});
device.InputAssembler.SetIndexBuffer(_meshIndexBuffer, SlimDX.DXGI.Format.R16_UInt, 0);
device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
_pass.Apply();
device.DrawIndexedInstanced(MeshToRender.IndexCount * 3, NPrimitives, 0, 0, 0);




Here's the draw code for DX9 :


device.VertexDeclaration = _layout;

device.SetStreamSource(0, _meshVertexBuffer, 0, 56);
device.SetStreamSourceFrequency(0, NPrimitives, StreamSource.IndexedData);

device.SetStreamSource(1, _instancesVertexBuffer, 0, 52);
device.SetStreamSourceFrequency(1, 1, StreamSource.InstanceData);

device.Indices = _meshIndexBuffer;

int passes = _shader.Shader.Begin();
for (int pass = 0; pass < passes; pass++)
{
_shader.Shader.BeginPass(pass);
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, MeshToRender.VertexCount, 0, MeshToRender.IndexCount);
_shader.Shader.EndPass();
}
_shader.Shader.End();

device.ResetStreamSourceFrequency(0);
device.ResetStreamSourceFrequency(1);




Can somebody with a DX10 card from Nvidia or ATI try with Pix and tell me if the DrawIndexedPrimitives counter is working for them in DX10?
Thanks!!!

EDIT : I've tried on a friend machine with a Nvidia Card, it seems that is an Intel Driver problem...because there the timing is the same between DirectX9 and DirectX10. Anyway i'll wait for clues from you...

[Edited by - feal87 on April 20, 2009 6:30:01 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!