[PATCH 5/7] wined3d: introduce a new wined3d_texture_blt function

Riccardo Bortolato rikyz619 at gmail.com
Tue Oct 13 04:47:09 CDT 2015


2015-10-13 8:09 GMT+02:00 Józef Kucia <joseph.kucia at gmail.com>:
> Just some nitpicks.
>
> On Mon, Oct 12, 2015 at 5:23 PM, Riccardo Bortolato <rikyz619 at gmail.com> wrote:
>> initial usage in d3d8
>>
>> Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
>> ---
>>  dlls/d3d8/device.c        | 12 ++++++------
>>  dlls/wined3d/texture.c    | 14 ++++++++++++++
>>  dlls/wined3d/wined3d.spec |  1 +
>>  include/wine/wined3d.h    |  3 +++
>>  4 files changed, 24 insertions(+), 6 deletions(-)
>>
>> diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
>> index 2b11923..95684c7 100644
>> --- a/dlls/d3d8/device.c
>> +++ b/dlls/d3d8/device.c
>> @@ -1093,8 +1093,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
>>      if (!rect_count && !src_rects && !dst_points)
>>      {
>>          RECT rect = {0, 0, src_w, src_h};
>> -        wined3d_surface_blt(dst->wined3d_surface, &rect,
>> -                src->wined3d_surface, &rect, 0, NULL, WINED3D_TEXF_POINT);
>> +        wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &rect,
>> +                src->wined3d_texture, src->sub_resource_idx, &rect, 0, NULL, WINED3D_TEXF_POINT);
>>      }
>>      else
>>      {
>> @@ -1109,8 +1109,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
>>                  RECT dst_rect = {dst_points[i].x, dst_points[i].y,
>>                          dst_points[i].x + w, dst_points[i].y + h};
>>
>> -                wined3d_surface_blt(dst->wined3d_surface, &dst_rect,
>> -                        src->wined3d_surface, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
>> +                wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
>> +                        src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
>>              }
>>          }
>>          else
>> @@ -1121,8 +1121,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
>>                  UINT h = src_rects[i].bottom - src_rects[i].top;
>>                  RECT dst_rect = {0, 0, w, h};
>>
>> -                wined3d_surface_blt(dst->wined3d_surface, &dst_rect,
>> -                        src->wined3d_surface, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
>> +                wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
>> +                        src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
>>              }
>>          }
>>      }
>> diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
>> index d5f9591..d93c241 100644
>> --- a/dlls/wined3d/texture.c
>> +++ b/dlls/wined3d/texture.c
>> @@ -1431,6 +1431,20 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
>>      return WINED3D_OK;
>>  }
>>
>> +HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
>> +        struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags,
>> +        const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
>> +{
>> +    struct wined3d_resource *dst_resource = wined3d_texture_get_sub_resource(dst_texture, dst_idx);
>> +    struct wined3d_resource *src_resource = wined3d_texture_get_sub_resource(src_texture, src_idx);
>> +
>> +    if (!dst_resource || !src_resource)
>> +        return WINED3DERR_INVALIDCALL;
>> +
>> +    return wined3d_surface_blt(surface_from_resource(dst_resource), dst_rect_in,
>> +        surface_from_resource(src_resource), src_rect_in, flags, fx, filter);
>> +}
>> +
>>  HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
>>          UINT level_count, DWORD surface_flags, const struct wined3d_sub_resource_data *data, void *parent,
>>          const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
>> diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
>> index 1569e24..22c6d23 100644
>> --- a/dlls/wined3d/wined3d.spec
>> +++ b/dlls/wined3d/wined3d.spec
>> @@ -259,6 +259,7 @@
>>  @ cdecl wined3d_swapchain_set_window(ptr ptr)
>>
>>  @ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
>> +@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
>>  @ cdecl wined3d_texture_create(ptr ptr long long ptr ptr ptr ptr)
>>  @ cdecl wined3d_texture_decref(ptr)
>>  @ cdecl wined3d_texture_generate_mipmaps(ptr)
>> diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
>> index 1735b95..b5f705c 100644
>> --- a/include/wine/wined3d.h
>> +++ b/include/wine/wined3d.h
>> @@ -2531,6 +2531,9 @@ void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, H
>>
>>  HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
>>          UINT layer, const struct wined3d_box *dirty_region);
>> +HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
>> +        struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags,
>> +        const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter);
>
> I think it would be preferred to use dst_sub_resource_idx and
> src_sub_resource_idx. Mostly for consistency.

They seem too verbose to me, but I don't have a strong opinion on this.

>
> Also, the patch 6 and 7 should be probably merged. It doesn't make
> sense to leave unused fields just to remove them in the next patch.

Alright, looks reasonable

>
>



More information about the wine-devel mailing list