Archived

This topic is now archived and is closed to further replies.

zedzeek

increasing d3d's rendering speed

Recommended Posts

zedzeek    528
i have written a simple app using d3d8. check it out on my site under demos/d3d vs opengl. but being a novice with d3d8. "if u can call 4 years experience a novice " im not to sure if im letting d3d render as fast as possible. ie the same app runs about 10% slower in d3d than it does in opengl but in theory there should be no speed difference. so ild appreciate if someone with a bit more d3d knowledge has a look. cheers zed http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
PSioNiC    122
Your problem is simply that your D3D application is not optimized. Its a simple as that. From my experiences, my Direct3D apps are at least 2x faster than my OpenGL programs.

My System:
Dual Celeron 366 OC 500
3fdx Voodoo5 5500 AGP
192 MB RAM

What you should do is start off with Microsoft''s base code, and then slowly alter it to fit your needs. I did that using a DrunkenHyena (whatever possesed him to make that alias) Direct3D tutorial. Now my code looks nothing alike. I get beautiful frame rates now in my engine.

Just do that and you should have no problems with speed

Share this post


Link to post
Share on other sites
zedzeek    528
uploaded a new version, where the window size is smaller ie so the benchmark is less influenced by the cards fillrate.
well i do have new drivers (10.80) for my vanta (tnt2) card, and experience no problems with it.

>> Your problem is simply that your D3D application is not optimized. <<

thats what i wanna know, how can i make it more optimized

>> From my experiences, my Direct3D apps are at least 2x faster than my OpenGL programs <<

do these programs do exactly the same things + can you post the code so we can all have a look.

as it stands at the moment the opengl version is gonna more than 50% quicker than the d3d version which shouldnt be, they should be running at roughly the same speed. so whats up

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
DrunkenHyena    805
quote:
Original post by PSioNiC
What you should do is start off with Microsoft''s base code, and then slowly alter it to fit your needs. I did that using a DrunkenHyena (whatever possesed him to make that alias) Direct3D tutorial. Now my code looks nothing alike. I get beautiful frame rates now in my engine.



G''day!

Drunken Hyena is the name of my company, since I am the sole proprietor it was handy to associate myself and the company. The name is taken from a poem.

Besides PSioNiC was already taken, and I always mis-type those mixed-case names.



Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Nutter2000    122
quote:
Original post by zedzeek
as it stands at the moment the opengl version is gonna more than 50% quicker than the d3d version which shouldnt be, they should be running at roughly the same speed. so whats up


What''s killing it is your update_and_draw_FPS function.

in the openGL version its simply updating the FPS counter,
in the D3D version you''re locking a vertex buffer and doing stuff.
However, you''re doing all that in between calling end scene and flushing the render pipeline with present.
So what''s happening is that in between finishing drawing and actually displaying the render buffer, you''re doing a huge lock on the VB(which incidently will slow down the gfx chip''s pipeline anyway)and going through a big ''for'' loop.
if you move the update_and_draw_FPS func. to before begin scene it should speed the whole thing up.

hope this helps.



"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

Share this post


Link to post
Share on other sites
zedzeek    528
it made no difference
i tried placing it before begin scene and also after begin scene.
is it possible to get rid of the buffer locking or put both the things in the same buffer ( which doesnt sound to flexible )

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
Nutter2000    122

hmmm..... sorry, it did make a difference on mine but it wasn''t as big as I''d thought. (oo-er )

I can''t see what''s wrong to be honest.

you COULD use the same VB but I''m not sure that''d make much speed difference.

incidently, you don''t need to set the FVF flag each time if it''s the same.



"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Have you tried to use D3DUSAGE_DYNAMIC when creating VB´s
and D3DLOCK_DISCARD or D3DLOCK_NOOVERWRITE when locking?

Peter

Share this post


Link to post
Share on other sites
Gorky    122
It''s probably a video card/driver issue.

On my home PC, OpenGL is much slower than DX.
My work PC, they are about the same.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Well I can''t help as I also have speed problems with DX (not using 8 but 7). I need to create a particle system that can blend the particles with the frame buffer and modulate the texture with the diffuse color. The blending and modulating works but it is very slow. When I render about 350 particles(700 triangles) the entire thing slows down to a crawl.

Any body know how I can speed it up so I can at least render about 1000 particles at a decent frame rate (about 20 to 30 FPS)?

The PC I am using is a P111 500, 128MB ram and a TnT 2 Ultra, so I don''t see why its so damn slow.

Share this post


Link to post
Share on other sites
Nutter2000    122

quote:
Message by Anon
Any body know how I can speed it up so I can at least render about 1000 particles at a decent frame rate (about 20 to 30 FPS)?


Apologies if this sounds a bit obvious but have you tried batching using a vertex buffer?


Zedzeek - this may sound a little daft but have you got debug information turned on fully in DirectX?

"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

Share this post


Link to post
Share on other sites
zedzeek    528
>> this may sound a little daft but have you got debug information turned on fully in DirectX?<<

i dont think so.

i have experimented with this D3DUSAGE_DYNAMIC D3DLOCK_DISCARD D3DLOCK_NOOVERWRITE + have managed to increase the speed (not by much though)

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
Nutter2000    122

Hmmmm...well,

D3DUSAGE_DYNAMIC tells direct3d and the therefore the gfx card that the vertex buffer is going to be constantly updated so it should put it somewhere quick to access. So that''s probably your speed increase.

D3DLOCK_DISCARD basically says that if you''re trying to write to a buffer which hasn''t finished rendering yet, ie. the buffer is essentially locked for rendering on the gfx card, then it should create another block of memory of the same size and put the new data in there until it''s all rendered off and the original memory is free again, I think it can do this up to about 8 times,
after which you''ll get a fill lock were it will wait to finish rendering before it continues. However, with your simple app I can''t see that happening.

D3DLOCK_NOOVERWRITE I think basically tells the vb that if it is full then wait until it''s all rendered before allowing you''re access. It basically locks until it''s free and only then can it add the new data. This is the one that''s most suitable for generally stuff.

I''d say you probably got the increase from using D3DLOCK_DYNAMIC.
but as you say, I wouldn''t expect a huge increase.


"Bad Day... F**K it!" -Stephen Baldwin (Usual Suspects)

Share this post


Link to post
Share on other sites