IDirect3D9Ex::CreateDeviceEx fails with D3DERR_INVALIDCALL only on one OS

Started by
4 comments, last by Hodgman 8 years, 6 months ago

This works on an Windows 8 machine, but not on a Windows 7 Embedded machine.

Here are the values I am giving the presentation params.

AHAOz.png

The parameters to the method are as follows.


CreateDeviceEx(0, 
   D3DDEVTYPE_HAL, 
   displayWindow, 
   presentationParams, 
   D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE | D3DCREATE_HARDWARE_VERTEXPROCESSING, 
   NULL, 
   &device);

Does anyone have an idea as to why I am getting D3DERR_INVALIDCALL?

Advertisement

UPDATE: The problem goes away when I use D3DMULTISAMPLE_NONE instead of D3DMULTISAMPLE_NONMASKABLE, but it the application. I'm not familiar with Direct3D to know why this is the case. Here is the code that renders pixels from a buffer.


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();
}

Any help would be appreciated.

I fixed it by enabling some 3D options in Intel's graphics properties (i7).

I'm no D3D guru, but I should imagine there's a way to check the device caps to verify if your multisampling is supported. Then you can validate if the machine meets your minimum requirements and spit out a more descriptive error message if not.

I'm no D3D guru, but I should imagine there's a way to check the device caps to verify if your multisampling is supported. Then you can validate if the machine meets your minimum requirements and spit out a more descriptive error message if not.

there is a get device caps method, that return a flag with all available caps.

Doing a check with a & caps.whatneeded, you can know what you need.

I'm no D3D guru, but I should imagine there's a way to check the device caps to verify if your multisampling is supported.

IDirect3D9::CheckDeviceMultiSampleType :)

However, unless you want everything to be MSAA'ed (including 2D HUD, post-processing, erx...), then you shouldn't create a multisampled back-buffer upon device creation. Instead, you can use IDirect3DDevice9::CreateRenderTarget to create an MSAA off-screen buffer, and then resolve it to the backbuffer (or another destination) with StretchRect.

This topic is closed to new replies.

Advertisement