ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

BOOL GetDeviceData ( LPD3D9_DEVICEDATA  pDeviceData)

Definition at line 126 of file d3d9_caps.c.

Referenced by CreateD3D9DeviceData(), DECLARE_INTERFACE_(), and ProcessSessionThreadRequest().

{
    BOOL bRet;
    D3DHAL_GLOBALDRIVERDATA GlobalDriverData;
    D3DHAL_D3DEXTENDEDCAPS D3dExtendedCaps;
    LPDDSURFACEDESC puD3dTextureFormats;
    DDPIXELFORMAT* pD3dZStencilFormatList;
    D3DDISPLAYMODE* pD3dDisplayModeList;
    D3DQUERYTYPE* pD3dQueryList;
    DWORD NumTextureFormats = 0;
    DWORD NumStencilFormats = 0;
    DWORD NumExtendedFormats = 0;
    DWORD NumQueries = 0;

    if (NULL == pDeviceData->pUnknown6BC)
    {
        CreateInternalDeviceData(
            pDeviceData->hDC,
            pDeviceData->szDeviceName,
            &pDeviceData->pUnknown6BC,
            pDeviceData->DeviceType,
            &pDeviceData->hD3DRefDll
            );

        if (NULL == pDeviceData->pUnknown6BC)
        {
            DPRINT1("Failed to create DirectDrawObject for Direct3D9");
            return FALSE;
        }
    }
    else
    {
        D3D9_DRIVERCAPS DriverCaps;
        D3D9_CALLBACKS D3D9Callbacks;

        if (FALSE == CanReenableDirectDrawObject(pDeviceData->pUnknown6BC))
        {
            DPRINT1("Failed to re-enable DirectDrawObject");
            return FALSE;
        }

        bRet = GetD3D9DriverInfo(
            pDeviceData->pUnknown6BC,
            &DriverCaps,
            &D3D9Callbacks,
            pDeviceData->szDeviceName,
            pDeviceData->hD3DRefDll,
            &GlobalDriverData,
            &D3dExtendedCaps,
            NULL,
            NULL,
            NULL,
            NULL,
            &NumTextureFormats,
            &NumStencilFormats,
            &NumExtendedFormats,
            &NumQueries
            );

        if (TRUE == bRet)
        {
            pDeviceData->DriverCaps.dwDisplayWidth = DriverCaps.dwDisplayWidth;
            pDeviceData->DriverCaps.dwDisplayHeight = DriverCaps.dwDisplayHeight;
            pDeviceData->DriverCaps.RawDisplayFormat = DriverCaps.RawDisplayFormat;
            pDeviceData->DriverCaps.DisplayFormat = DriverCaps.DisplayFormat;
            pDeviceData->DriverCaps.dwRefreshRate = DriverCaps.dwRefreshRate;
        }

        return bRet;
    }

    /* Cleanup of old stuff */
    if (pDeviceData->DriverCaps.pSupportedFormatOps)
    {
        HeapFree(GetProcessHeap(), 0, pDeviceData->DriverCaps.pSupportedFormatOps);
        pDeviceData->DriverCaps.pSupportedFormatOps = NULL;
    }
    if (pDeviceData->DriverCaps.pSupportedExtendedModes)
    {
        HeapFree(GetProcessHeap(), 0, pDeviceData->DriverCaps.pSupportedExtendedModes);
        pDeviceData->DriverCaps.pSupportedExtendedModes = NULL;
    }
    if (pDeviceData->DriverCaps.pSupportedQueriesList)
    {
        HeapFree(GetProcessHeap(), 0, pDeviceData->DriverCaps.pSupportedQueriesList);
        pDeviceData->DriverCaps.pSupportedQueriesList = NULL;
    }

    if (FALSE == CanReenableDirectDrawObject(pDeviceData->pUnknown6BC))
    {
        DPRINT1("Failed to re-enable DirectDrawObject");
        ReleaseInternalDeviceData(pDeviceData);
        return FALSE;
    }

    bRet = GetD3D9DriverInfo(
        pDeviceData->pUnknown6BC,
        &pDeviceData->DriverCaps,
        &pDeviceData->D3D9Callbacks,
        pDeviceData->szDeviceName,
        pDeviceData->hD3DRefDll,
        &GlobalDriverData,
        &D3dExtendedCaps,
        NULL,
        NULL,
        NULL,
        NULL,
        &NumTextureFormats,
        &NumStencilFormats,
        &NumExtendedFormats,
        &NumQueries
        );

    if (FALSE == bRet)
    {
        DPRINT1("Could not query DirectDrawObject, aborting");
        ReleaseInternalDeviceData(pDeviceData);
        return FALSE;
    }

    puD3dTextureFormats = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, max(NumTextureFormats, 1) * sizeof(DDSURFACEDESC));
    pD3dZStencilFormatList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, max(NumStencilFormats, 1) * sizeof(DDPIXELFORMAT));
    pD3dDisplayModeList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, max(NumExtendedFormats, 1) * sizeof(D3DDISPLAYMODE));
    pD3dQueryList = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, max(NumQueries, 1) * sizeof(D3DQUERYTYPE));

    bRet = GetD3D9DriverInfo(
        pDeviceData->pUnknown6BC,
        &pDeviceData->DriverCaps,
        &pDeviceData->D3D9Callbacks,
        pDeviceData->szDeviceName,
        pDeviceData->hD3DRefDll,
        &GlobalDriverData,
        &D3dExtendedCaps,
        puD3dTextureFormats,
        pD3dZStencilFormatList,
        pD3dDisplayModeList,
        pD3dQueryList,
        &NumTextureFormats,
        &NumStencilFormats,
        &NumExtendedFormats,
        &NumQueries
        );

    if (FALSE == bRet)
    {
        DPRINT1("Could not query DirectDrawObject, aborting");
        HeapFree(GetProcessHeap(), 0, puD3dTextureFormats);
        HeapFree(GetProcessHeap(), 0, pD3dZStencilFormatList);
        HeapFree(GetProcessHeap(), 0, pD3dDisplayModeList);
        HeapFree(GetProcessHeap(), 0, pD3dQueryList);
        ReleaseInternalDeviceData(pDeviceData);
        return FALSE;
    }

    pDeviceData->DriverCaps.NumSupportedFormatOps = NumTextureFormats;
    if (NumTextureFormats > 0)
        pDeviceData->DriverCaps.pSupportedFormatOps = puD3dTextureFormats;

    pDeviceData->DriverCaps.NumSupportedExtendedModes = NumExtendedFormats;
    if (NumExtendedFormats > 0)
        pDeviceData->DriverCaps.pSupportedExtendedModes = pD3dDisplayModeList;

    pDeviceData->DriverCaps.NumSupportedQueries = NumQueries;
    if (NumQueries > 0)
        pDeviceData->DriverCaps.pSupportedQueriesList = pD3dQueryList;
    
    HeapFree(GetProcessHeap(), 0, pD3dZStencilFormatList); 

    return TRUE;
}

Generated on Sun May 27 2012 05:01:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.