0
這適用於Windows 8計算機,但不適用於Windows 7嵌入式計算機。IDirect3D9Ex :: CreateDeviceEx僅在一個操作系統上因D3DERR_INVALIDCALL而失敗
下面是我給出的演示參數的值。
的參數的方法如下。
CreateDeviceEx(0,
D3DDEVTYPE_HAL,
displayWindow,
presentationParams,
D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE | D3DCREATE_HARDWARE_VERTEXPROCESSING,
NULL,
&device);
有沒有人有一個想法,爲什麼我得到D3DERR_INVALIDCALL
?
UPDATE:當我使用D3DMULTISAMPLE_NONE而不是D3DMULTISAMPLE_NONMASKABLE,但它是應用程序時,問題消失。我對Direct3D不熟悉,不知道爲什麼會出現這種情況。這是從緩衝區呈現像素的代碼。
HRESULT D3D9RenderImpl::CaptureDisplayFrame(BYTE* pBuffer, INT* width, INT* height, INT* stride)
{
CComPtr<IDirect3DSurface9> pTargetSurface;
CComPtr<IDirect3DSurface9> pTempSurface;
HR(m_pDevice->GetRenderTarget(0, &pTargetSurface));
D3DSURFACE_DESC desc;
HR(pTargetSurface->GetDesc(&desc));
if(!pBuffer)
{
*width = desc.Width;
*height = desc.Height;
*stride = desc.Width * 4; // Always ARGB32
return S_OK;
}
HR(m_pDevice->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pTempSurface, NULL));
HR(m_pDevice->GetRenderTargetData(pTargetSurface, pTempSurface));
D3DLOCKED_RECT d3drect;
HR(pTempSurface->LockRect(&d3drect, NULL, D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_NOSYSLOCK | D3DLOCK_READONLY));
BYTE* pFrame = (BYTE*)d3drect.pBits;
memcpy(pBuffer, pFrame, desc.Height * d3drect.Pitch);
return pTempSurface->UnlockRect();
}