[PATCH v2] wined3d: Allow setting user memory for mipmapped texture in wined3d_texture_update_desc().

Paul Gofman pgofman at codeweavers.com
Fri May 8 12:56:31 CDT 2020

On 5/8/20 20:40, Henri Verbeet wrote:
> On Thu, 7 May 2020 at 13:54, Paul Gofman <pgofman at codeweavers.com> wrote:
>> +    set_user_memory_only = width == texture->resource.width && height == texture->resource.height
>> +            && format_id == texture->resource.format->id && multisample_type == texture->resource.multisample_type
>> +            && multisample_quality == texture->resource.multisample_quality
>> +            && (!texture->row_pitch || pitch == texture->row_pitch);
>> +
> The pitch handling doesn't seem quite right. I.e., if
> texture->row_pitch is currently 0 (default), it effectively has the
> value calculated by wined3d_format_calculate_pitch() with the default
> alignment. That's potentially different from "pitch". Even if "pitch"
> is 0 itself, it may still be effectively different due to the
> different alignment value. You'll probably want to first calculate the
> effective current and new pitch, and then compare those.
Yes, sure.
> Does SetSurfaceDesc() work with mip-mapped surfaces as well? Otherwise
> we may have to explicitly disallow them there. Likewise for surfaces
> created with DDSD_LPSURFACE set.

I tried to create a mipmapped surface with DDSD_LPSURFACE on Windows but
failed to get a working flags combination for that. The main constraint
is that mipmap should be texture which is supposed to be in video memory
which does not allow DDSD_LPSURFACE. So unless I missed something there
it does not look possible to create a DDSD_LPSURFACE mimapped texture on
hardware device. Regarding SetSurfaceDesc(), I will test that with
mipmaps, looks like there are no tests for that in test_set_surface_desc().

More information about the wine-devel mailing list