不能使用PerfHUD的原因

不能使用PerfHUD的原因
the reason why we can not use PerfHUD :

usually, the default SwapChain will be used when the d3d  device is created.
通常情况下,当创建好d3d设备时,会使用默认的SwapChain,
the process of render is as follows:
渲染流程如下:
d3d9->CreateDevice(AdapterToUse, DeviceType,hwnd,  vp,  &d3dpp, &Device);

Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0);
Device->BeginScene();
Device->SetStreamSource(0, Triangle, 0, sizeof(Vertex));
Device->SetFVF(Vertex::FVF);
// Draw one triangle.
Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
Device->EndScene();
Device->Present(0, 0, 0, 0);

很多编辑器的渲染结构,不使用上面的方式,而是会创建单独的SwapChain,

这样的好处是可以在多窗口中使用d3d设备
the process is as follows:
流程如下:
d3d9->CreateDevice(AdapterToUse, DeviceType,hwnd,  vp,  &d3dpp, &Device);

D3DPRESENT_PARAMETERS presentParams = {0};
presentParams.BackBufferFormat = D3DFMT_A8R8G8B8;
presentParams.BackBufferCount = 1;
presentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
presentParams.Windowed = TRUE;
presentParams.hDeviceWindow = hwnd;
presentParams.MultiSampleType = D3DMULTISAMPLE_NONE;
presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
Device->CreateAdditionalSwapChain( &presentParams,&SwapChain);

IDirect3DSurface9 *pTempD3dSurface9 = NULL;
SwapChain->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &pTempD3dSurface9 );
Device->SetRenderTarget( 0, pTempD3dSurface9 );

Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0);
Device->BeginScene();

Device->SetStreamSource(0, Triangle, 0, sizeof(Vertex));
Device->SetFVF(Vertex::FVF);

// Draw one triangle.
Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

Device->EndScene();
  
SwapChain->Present(0,0,0,0,0);

目前PerfHUD不支持这种另外创建SwapChain的方式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值