How to improve Direct3D streaming performance?

I am trying to speed up drawing a full-screen texture that changes every frame. On my system, I can get around 1000 FPS using GDI and BitBlt (), but I thought I could improve performance using Direct3D and dynamic textures. Instead, I get only 250 FPS.

I am working on a Mac Pro with an ATI HD 4870 with current drivers.

I tried using dynamic textures and this gives me a small gain (~ 15FPS), and I tried using a texture chain to avoid pipelines, and this has no effect.

I looked through quite a lot and very little information about using dynamic textures in this way.

Am I missing something fundamental?

Device Setup:

  pparams.BackBufferCount = 1;
 pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
 pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

Texture Creation:

  device-> CreateTexture (width, height, 1, D3DUSAGE_DYNAMIC,
                       D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, & texture, NULL);

Texture Update:

  texture-> LockRect (0, & locked, NULL, D3DLOCK_DISCARD);
 ... write texture data
 texture-> UnlockRect (0);
 device-> DrawPrimitiveUP (D3DPT_TRIANGLEFAN, 2, vertices, sizeof (* vertices));
 ...

You can get the execution code from http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!

+4
source share
2 answers

If you do not need to read the texture, you can create a texture with (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY).

+3
source

DrawPrimitiveUP is very slow. You should use a dynamic vertex buffer (update with nooverwrite, discard if full).

+1
source

Source: https://habr.com/ru/post/1338618/


All Articles