Example #1
0
HRESULT
NineSwapChain9_ctor( struct NineSwapChain9 *This,
                     struct NineUnknownParams *pParams,
                     BOOL implicit,
                     ID3DPresent *pPresent,
                     struct d3dadapter9_context *pCTX,
                     HWND hFocusWindow )
{
    D3DPRESENT_PARAMETERS params;
    HRESULT hr;

    DBG("This=%p pDevice=%p pPresent=%p pCTX=%p hFocusWindow=%p\n",
        This, pParams->device, pPresent, pCTX, hFocusWindow);

    hr = NineUnknown_ctor(&This->base, pParams);
    if (FAILED(hr))
        return hr;

    This->screen = NineDevice9_GetScreen(This->base.device);
    This->pipe = NineDevice9_GetPipe(This->base.device);
    This->cso = NineDevice9_GetCSO(This->base.device);
    This->implicit = implicit;
    This->actx = pCTX;
    This->present = pPresent;
    ID3DPresent_AddRef(pPresent);
    hr = ID3DPresent_GetPresentParameters(This->present, &params);
    if (FAILED(hr))
        return hr;
    if (!params.hDeviceWindow)
        params.hDeviceWindow = hFocusWindow;

    return NineSwapChain9_Resize(This, &params);
}
Example #2
0
HRESULT
NineSwapChain9_ctor( struct NineSwapChain9 *This,
                     struct NineUnknownParams *pParams,
                     BOOL implicit,
                     ID3DPresent *pPresent,
                     D3DPRESENT_PARAMETERS *pPresentationParameters,
                     struct d3dadapter9_context *pCTX,
                     HWND hFocusWindow,
                     D3DDISPLAYMODEEX *mode )
{
    HRESULT hr;

    DBG("This=%p pDevice=%p pPresent=%p pCTX=%p hFocusWindow=%p\n",
        This, pParams->device, pPresent, pCTX, hFocusWindow);

    hr = NineUnknown_ctor(&This->base, pParams);
    if (FAILED(hr))
        return hr;

    This->screen = NineDevice9_GetScreen(This->base.device);
    This->implicit = implicit;
    This->actx = pCTX;
    This->present = pPresent;
    This->mode = NULL;

    ID3DPresent_AddRef(pPresent);
    if (!This->actx->thread_submit &&
        This->base.device->minor_version_num > 2) {
        D3DPRESENT_PARAMETERS2 params2;

        memset(&params2, 0, sizeof(D3DPRESENT_PARAMETERS2));
        params2.AllowDISCARDDelayedRelease = This->actx->discard_delayed_release;
        params2.TearFreeDISCARD = This->actx->tearfree_discard;
        ID3DPresent_SetPresentParameters2(pPresent, &params2);
    }

    if (!pPresentationParameters->hDeviceWindow)
        pPresentationParameters->hDeviceWindow = hFocusWindow;

    This->rendering_done = FALSE;
    This->pool = NULL;
    return NineSwapChain9_Resize(This, pPresentationParameters, mode);
}