Exemplo n.º 1
0
static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OUTPUT_DESC *desc)
{
    struct dxgi_output *This = impl_from_IDXGIOutput(iface);
    struct wined3d *wined3d;
    MONITORINFOEXW monitor_info;

    FIXME("iface %p, desc %p semi-stub!\n", iface, desc);

    if (!desc)
        return DXGI_ERROR_INVALID_CALL;

    wined3d = This->adapter->parent->wined3d;

    EnterCriticalSection(&dxgi_cs);
    desc->Monitor = wined3d_get_adapter_monitor(wined3d, This->adapter->ordinal);
    LeaveCriticalSection(&dxgi_cs);

    if (!desc->Monitor)
        return DXGI_ERROR_INVALID_CALL;

    monitor_info.cbSize = sizeof(monitor_info);
    if (!GetMonitorInfoW(desc->Monitor, (MONITORINFO *)&monitor_info))
        return DXGI_ERROR_INVALID_CALL;

    memcpy(&desc->DeviceName, &monitor_info.szDevice, sizeof(desc->DeviceName));
    memcpy(&desc->DesktopCoordinates, &monitor_info.rcMonitor, sizeof(RECT));
    desc->AttachedToDesktop = TRUE;
    desc->Rotation = DXGI_MODE_ROTATION_IDENTITY;

    return S_OK;
}
Exemplo n.º 2
0
static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput *iface,
        REFIID riid, void **parent)
{
    struct dxgi_output *This = impl_from_IDXGIOutput(iface);

    TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);

    return IDXGIAdapter_QueryInterface((IDXGIAdapter *)This->adapter, riid, parent);
}
Exemplo n.º 3
0
static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput *iface)
{
    struct dxgi_output *This = impl_from_IDXGIOutput(iface);
    ULONG refcount = InterlockedIncrement(&This->refcount);

    TRACE("%p increasing refcount to %u.\n", This, refcount);

    return refcount;
}
Exemplo n.º 4
0
static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput *iface,
        REFGUID guid, UINT *data_size, void *data)
{
    struct dxgi_output *output = impl_from_IDXGIOutput(iface);

    TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);

    return dxgi_get_private_data(&output->private_store, guid, data_size, data);
}
Exemplo n.º 5
0
static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput *iface,
        REFGUID guid, const IUnknown *object)
{
    struct dxgi_output *output = impl_from_IDXGIOutput(iface);

    TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);

    return dxgi_set_private_data_interface(&output->private_store, guid, object);
}
Exemplo n.º 6
0
static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput *iface)
{
    struct dxgi_output *This = impl_from_IDXGIOutput(iface);
    ULONG refcount = InterlockedDecrement(&This->refcount);

    TRACE("%p decreasing refcount to %u.\n", This, refcount);

    if (!refcount)
    {
        HeapFree(GetProcessHeap(), 0, This);
    }

    return refcount;
}
Exemplo n.º 7
0
static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *iface,
        DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC *desc)
{
    struct dxgi_output *This = impl_from_IDXGIOutput(iface);
    enum wined3d_format_id wined3d_format;
    struct wined3d *wined3d;
    UINT i;
    UINT max_count;

    FIXME("iface %p, format %s, flags %#x, mode_count %p, desc %p partial stub!\n",
            iface, debug_dxgi_format(format), flags, mode_count, desc);

    if (!mode_count)
    {
        return S_OK;
    }

    if (format == DXGI_FORMAT_UNKNOWN)
    {
        *mode_count = 0;
        return S_OK;
    }

    wined3d = IWineDXGIFactory_get_wined3d(This->adapter->parent);
    wined3d_format = wined3dformat_from_dxgi_format(format);

    EnterCriticalSection(&dxgi_cs);
    max_count = wined3d_get_adapter_mode_count(wined3d, This->adapter->ordinal,
            wined3d_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);

    if (!desc)
    {
        wined3d_decref(wined3d);
        LeaveCriticalSection(&dxgi_cs);
        *mode_count = max_count;
        return S_OK;
    }

    *mode_count = min(*mode_count,max_count);

    for (i = 0; i < *mode_count; ++i)
    {
        struct wined3d_display_mode mode;
        HRESULT hr;

        hr = wined3d_enum_adapter_modes(wined3d, This->adapter->ordinal, wined3d_format,
                WINED3D_SCANLINE_ORDERING_UNKNOWN, i, &mode);
        if (FAILED(hr))
        {
            WARN("EnumAdapterModes failed, hr %#x.\n", hr);
            wined3d_decref(wined3d);
            LeaveCriticalSection(&dxgi_cs);
            return hr;
        }

        desc[i].Width = mode.width;
        desc[i].Height = mode.height;
        desc[i].RefreshRate.Numerator = mode.refresh_rate;
        desc[i].RefreshRate.Denominator = 1;
        desc[i].Format = format;
        desc[i].ScanlineOrdering = mode.scanline_ordering;
        desc[i].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
    }
    wined3d_decref(wined3d);
    LeaveCriticalSection(&dxgi_cs);

    return S_OK;
}