wined3d public api cleanup

Henri Verbeet hverbeet at gmail.com
Fri Sep 11 09:48:08 CDT 2015


On 11 September 2015 at 09:08, Riccardo Bortolato <rikyz619 at gmail.com> wrote:
>
> Here is a follow up on the small fixes I sent the other day.
>
> I'm storing the wined3d texture and sub level in the d3dX surfaces/volumes
> and this allows to go further with the removal of surfaces/volumes from the public api.
>
> With these commits I also introduce a temporary function to handle mapping
> for surfaces and volumes which I hope it will gradually handle more of that
> eventually delegating only bound checks (and maybe other minor things) to helper functions.
>
> Finally the remaining volume-related exported functions are removed.
>
At first sight this looks mostly ok. You may want to merge patches 1/6
and 2/6, since they mostly seem to be touching the same places and are
closely related anyway. Once you pass the wined3d texture to
device_parent_surface_created()/device_parent_volume_created() you no
longer need to pass "container_parent", since you can just call
wined3d_texture_get_parent() on the wined3d texture to get it. You'll
probably want to rename "idx" to "sub_resource_idx" and just make it
unsigned int.

In patch 3/6 the decision to use wined3d_volume_map() or
wined3d_surface_map() should probably go through wined3d_texture_ops.
Just pass a wined3d_box structure insead of a void pointer. (And
passing a wined3d_box structure to wined3d_surface_map() should
probably be a preparation patch for that.) Usage and introduction
should go together in patches 3/6 and 4/6, but you can do map() and
unmap() in separate patches. You could also potentially further split
that per-dll/sub-resource type (E.g. "d3d9: Use wined3d_texture_map()
in d3d9_surface_LockRect()."), although I don't think the patch is
excessively large as it is.
wined3d_texture_map()/wined3d_texture_unmap() is fine for the function
names, no need for the extra "sub_resource" there.

> -    hr = wined3d_surface_unmap(surface->wined3d_surface);
> +    wined3d_texture_sub_resource_unmap(surface->wined3d_texture, surface->sub_resource_idx);
>      if (SUCCEEDED(hr) && surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
You're dropping the return code here.

You can drop the __cdecl in patch 5/6. I think
wined3d_volume_get_resource() should be unused after patch 6/6, and I
think you should be able to just use volume->wined3d_texture instead
of volume->texture->wined3d_texture.

> What to do with buffers is still unclear to me.
>
I think it's mostly of later concern, after surfaces and volumes are
unified, but the idea is to eventually have something like
wined3d_resource_map() that just ignores the sub-resource index for
buffers. (Or perhaps requires it to be 0.)



More information about the wine-devel mailing list