Пример #1
0
HRESULT NINE_WINAPI
NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
                              D3DDEVTYPE DevType,
                              D3DFORMAT AdapterFormat,
                              D3DFORMAT BackBufferFormat,
                              BOOL bWindowed )
{
    struct pipe_screen *screen;
    enum pipe_format dfmt, bfmt;
    HRESULT hr;

    DBG("This=%p DevType=%s AdapterFormat=%s BackBufferFormat=%s "
        "bWindowed=%i\n", This, nine_D3DDEVTYPE_to_str(DevType),
        d3dformat_to_string(AdapterFormat),
        d3dformat_to_string(BackBufferFormat), bWindowed);

    user_assert(backbuffer_format(AdapterFormat, BackBufferFormat, bWindowed),
                D3DERR_NOTAVAILABLE);

    hr = NineAdapter9_GetScreen(This, DevType, &screen);
    if (FAILED(hr)) { return hr; }

    /* The display format is not handled in Nine. We always present an XRGB8888
     * buffer (and the display server will eventually do the conversion). We probably
     * don't need to check for anything for the adapter format support, since if the
     * display server advertise support, it will likely be able to do the conversion.
     * We do the approximation that a format is available in the display server if
     * the format passes with NINE_BIND_BACKBUFFER_FLAGS */
    dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D,
                                       1,
                                       NINE_BIND_BACKBUFFER_FLAGS, FALSE, FALSE);
    bfmt = d3d9_to_pipe_format_checked(screen, BackBufferFormat, PIPE_TEXTURE_2D,
                                       1,
                                       NINE_BIND_BACKBUFFER_FLAGS, FALSE, FALSE);
    if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) {
        DBG("Unsupported Adapter/BackBufferFormat.\n");
        return D3DERR_NOTAVAILABLE;
    }

    return D3D_OK;
}
Пример #2
0
HRESULT NINE_WINAPI
NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
                                          D3DDEVTYPE DeviceType,
                                          D3DFORMAT SourceFormat,
                                          D3DFORMAT TargetFormat )
{
    /* MSDN says this tests whether a certain backbuffer format can be used in
     * conjunction with a certain front buffer format. It's a little confusing
     * but some one wiser might be able to figure this one out. XXX */
    struct pipe_screen *screen;
    enum pipe_format dfmt, bfmt;
    HRESULT hr;

    DBG("This=%p DeviceType=%s SourceFormat=%s TargetFormat=%s\n", This,
        nine_D3DDEVTYPE_to_str(DeviceType),
        d3dformat_to_string(SourceFormat), d3dformat_to_string(TargetFormat));

    user_assert(backbuffer_format(TargetFormat, SourceFormat, FALSE),
                D3DERR_NOTAVAILABLE);

    hr = NineAdapter9_GetScreen(This, DeviceType, &screen);
    if (FAILED(hr)) { return hr; }

    dfmt = d3d9_to_pipe_format_checked(screen, TargetFormat, PIPE_TEXTURE_2D, 1,
                                       PIPE_BIND_DISPLAY_TARGET |
                                       PIPE_BIND_SHARED, FALSE, FALSE);
    bfmt = d3d9_to_pipe_format_checked(screen, SourceFormat, PIPE_TEXTURE_2D, 1,
                                       PIPE_BIND_DISPLAY_TARGET |
                                       PIPE_BIND_SHARED, FALSE, FALSE);

    if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) {
        DBG("%s to %s not supported.\n",
            d3dformat_to_string(SourceFormat),
            d3dformat_to_string(TargetFormat));
        return D3DERR_NOTAVAILABLE;
    }

    return D3D_OK;
}
Пример #3
0
HRESULT NINE_WINAPI
NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
                              D3DDEVTYPE DevType,
                              D3DFORMAT AdapterFormat,
                              D3DFORMAT BackBufferFormat,
                              BOOL bWindowed )
{
    struct pipe_screen *screen;
    enum pipe_format dfmt, bfmt;
    HRESULT hr;

    DBG("This=%p DevType=%s AdapterFormat=%s BackBufferFormat=%s "
        "bWindowed=%i\n", This, nine_D3DDEVTYPE_to_str(DevType),
        d3dformat_to_string(AdapterFormat),
        d3dformat_to_string(BackBufferFormat), bWindowed);

    user_assert(backbuffer_format(AdapterFormat, BackBufferFormat, bWindowed),
                D3DERR_NOTAVAILABLE);

    hr = NineAdapter9_GetScreen(This, DevType, &screen);
    if (FAILED(hr)) { return hr; }

    dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D,
                                       1,
                                       PIPE_BIND_DISPLAY_TARGET |
                                       PIPE_BIND_SHARED, FALSE, FALSE);
    bfmt = d3d9_to_pipe_format_checked(screen, BackBufferFormat, PIPE_TEXTURE_2D,
                                       1,
                                       PIPE_BIND_DISPLAY_TARGET |
                                       PIPE_BIND_SHARED, FALSE, FALSE);
    if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) {
        DBG("Unsupported Adapter/BackBufferFormat.\n");
        return D3DERR_NOTAVAILABLE;
    }

    return D3D_OK;
}