如何提高Direct3D流纹理性能? [英] How do I improve Direct3D streaming texture performance?

查看:89
本文介绍了如何提高Direct3D流纹理性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试加速全屏纹理的绘制,该纹理每帧都会改变。在我的系统上,使用GDI和BitBlt()可以获得大约1000 FPS,但是我认为可以通过使用Direct3D和动态纹理来提高性能。取而代之的是,我只能达到大约250 FPS。

I'm trying to accelerate the drawing of a full-screen texture which changes every frame. On my system, I can get around 1000 FPS using GDI and BitBlt(), but I thought I could improve performance by using Direct3D and dynamic textures. Instead I'm only getting around 250 FPS.

我正在运行带有当前驱动程序的ATI HD 4870的Mac Pro。

I'm running on a Mac Pro with an ATI HD 4870 with current drivers.

我尝试使用动态纹理,这给了我一个小增益(〜15FPS),并且我尝试使用纹理链来避免流水线停顿,并且没有效果。

I've tried using dynamic textures and that gives me a small gain (~15FPS) and I've tried using a texture chain to avoid pipeline stalls and that has no effect.

我四处张望,以这种方式使用动态纹理的信息很少。

I've looked around quite a bit and there's very little information on using dynamic textures this way.

我缺少基本的东西吗?

Am I missing something fundamental?

设备设置:


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

纹理创建:


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

纹理更新:


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

您可以从
http://www.libsdl.org/tmp/SDL-1.3.zip

谢谢!

推荐答案

如果不需要读回纹理,则可以创建具有(D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)标志的纹理。

If you don't need to read back the texture, then you can create a texture with (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY) flag.

这篇关于如何提高Direct3D流纹理性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆