[PATCH v2 8/9] d3d11: Implement Texture1D.

Matteo Bruni matteo.mystral at gmail.com
Thu Jan 4 13:12:58 CST 2018


2018-01-04 12:21 GMT+01:00 Józef Kucia <joseph.kucia at gmail.com>:
> On Wed, Jan 3, 2018 at 4:18 PM, Sven Hesse <shesse at codeweavers.com> wrote:
>> +/*
>> +static BOOL is_gdi_compatible_texture(const D3D11_TEXTURE1D_DESC *desc)
>> +{
>> +    if (!(desc->Format == DXGI_FORMAT_B8G8R8A8_UNORM
>> +            || desc->Format == DXGI_FORMAT_B8G8R8A8_TYPELESS
>> +            || desc->Format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB))
>> +        return FALSE;
>> +
>> +    if (desc->Usage != D3D11_USAGE_DEFAULT)
>> +        return FALSE;
>> +
>> +    return TRUE;
>> +}
>> +
>> +static BOOL validate_texture1d_desc(const D3D11_TEXTURE1D_DESC *desc)
>> +{
>> +    if (desc->MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE
>> +            && desc->ArraySize < 6)
>> +    {
>> +        WARN("Invalid array size %u for cube texture.\n", desc->ArraySize);
>> +        return FALSE;
>> +    }
>> +
>> +    if (desc->MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE
>> +            && !is_gdi_compatible_texture(desc))
>> +    {
>> +        WARN("Incompatible description used to create GDI compatible texture.\n");
>> +        return FALSE;
>> +    }
>> +
>> +    return TRUE;
>> +}
>
> It would be good to test if 1D textures need GDI support.
>
>> +*/
>> +
>> +HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DESC *desc,
>> +        const D3D11_SUBRESOURCE_DATA *data, struct d3d_texture1d **out)
>> +{
>> +    struct wined3d_resource_desc wined3d_desc;
>> +    struct d3d_texture1d *texture;
>> +    unsigned int levels;
>> +    DWORD flags = 0;
>> +    HRESULT hr;
>> +
>> +/*
>> +    if (!validate_texture1d_desc(desc))
>> +    {
>> +        WARN("Failed to validate texture desc.\n");
>> +        return E_INVALIDARG;
>> +    }
>> +*/
>> +
>
> Please do not introduce commented out code.

Yeah, you need to resolve this one way or another. I don't think 1D
cube textures can possibly be a thing, but in general this is matter
of writing some tests.



More information about the wine-devel mailing list