[v3 signed 1/6] d3d9: improved d3d9_device_UpdateSurface

Riccardo Bortolato rikyz619 at gmail.com
Tue Oct 27 13:01:44 CDT 2015


Sorry, gmail somehow sent this incomplete draft.. however, here's the
complete mail.

Why wined3d_device_copy_sub_resource_region() isn't implemented for
WINED3D_RTYPE_CUBE_TEXTURE?

This seems the easiest option to me (if we exclude the already
available one) but it looks like I'm having an issue with them: the
destination surface is smaller than the source one.

I'm doing something like

+ sub_resource =
wined3d_texture_get_sub_resource(src->wined3d_texture,
src->sub_resource_idx);
+ wined3d_resource_get_desc(sub_resource, &src_desc);
+ sub_resource =
wined3d_texture_get_sub_resource(dst->wined3d_texture,
dst->sub_resource_idx);
+ wined3d_resource_get_desc(sub_resource, &dst_desc);
+
+ if (src_desc.pool != WINED3D_POOL_SYSTEM_MEM || dst_desc.pool !=
WINED3D_POOL_DEFAULT)
+ {
+ WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT,
returning WINED3DERR_INVALIDCALL\n",
+ src_surface, dst_surface);
+ wined3d_mutex_unlock();
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (src_rect)
+ {
+ src_box.left = src_rect->left;
+ src_box.top = src_rect->top;
+ src_box.right = src_rect->right;
+ src_box.bottom = src_rect->bottom;
+ src_box.front = 0;
+ src_box.back = 1;
+ }
+ else
+ {
+ src_box.left = 0;
+ src_box.top = 0;
+ src_box.right = src_desc.width;
+ src_box.bottom = src_desc.height;
+ src_box.front = 0;
+ src_box.back = 1;
+ }
+
+ hr = wined3d_device_copy_sub_resource_region(device->wined3d_device,
+ wined3d_texture_get_resource(dst->wined3d_texture),
dst->sub_resource_idx, dst_point ? dst_point->x : 0,
+ dst_point ? dst_point->y : 0, 0,
wined3d_texture_get_resource(src->wined3d_texture),
+ src->sub_resource_idx, &src_box);

But test_cube_wrap() (d3d9/visual.c) fails in UpdateSurface (if I got
debug right); the destination surface is smaller than the src rect
(I'm either getting the wrong sub index (e.g. the next mip) or what?),
this happens when the application (in this case the test) calls with
null src rect and dst point.

Am I doing anything horribly wrong?

Ciao,
Riccardo

2015-10-27 18:59 GMT+01:00 Riccardo Bortolato <rikyz619 at gmail.com>:
> Why wined3d_device_copy_sub_resource_region() isn't implemented for
> WINED3D_RTYPE_CUBE_TEXTURE?
>
> This seems the easiest option to me (if we exclude the already
> available one) but it looks like I'm having an issue with them: the
> destination surface is smaller than the source one.
>
> I'm doing something like
>
> + if (src_rect)
> + {
> + src_box.left = src_rect->left;
> + src_box.top = src_rect->top;
> + src_box.right = src_rect->right;
> + src_box.bottom = src_rect->bottom;
> + src_box.front = 0;
> + src_box.back = 1;
> + }
> + else
> + {
> + src_box.left = 0;
> + src_box.top = 0;
> + src_box.right = src_desc.width;
> + src_box.bottom = src_desc.height;
> + src_box.front = 0;
> + src_box.back = 1;
> + }
> +
> + hr = wined3d_device_copy_sub_resource_region(device->wined3d_device,
> + wined3d_texture_get_resource(dst->wined3d_texture),
> dst->sub_resource_idx, dst_point ? dst_point->x : 0,
> + dst_point ? dst_point->y : 0, 0,
> wined3d_texture_get_resource(src->wined3d_texture),
> + src->sub_resource_idx, &src_box);
>
> But test_cube_wrap() (d3d9/visual.c) fails in UpdateSurface (if I got
> debug right); the destination surface is smaller than the src rect
> (I'm I'm either getting the wrong sub index (e.g. the next mip) or
>
> Ciao,
> Riccardo
>
> 2015-10-27 16:15 GMT+01:00 Riccardo Bortolato <rikyz619 at gmail.com>:
>> OK, but since I could not find a definite answer I tried another road.
>>
>> I assume you don't even want to look at it but use those methods instead.
>>
>> Ciao,
>> Riccardo
>>
>> 2015-10-27 15:40 GMT+01:00 Henri Verbeet <hverbeet at gmail.com>:
>>> On 22 October 2015 at 12:01, Riccardo Bortolato <rikyz619 at gmail.com> wrote:
>>>> enabled previously failing test in device.c
>>>> removed wined3d_device_update_surface from wined3d and replaced its usage with surface_upload_from_surface.
>>>>
>>> This was mentioned in the discussion in the other thread, but just for
>>> the record, the options are either
>>> wined3d_device_update_sub_resource() or
>>> wined3d_device_copy_sub_resource_region().
>>>
>>>



More information about the wine-devel mailing list