Am 02.11.2015 um 04:17 schrieb Józef Kucia jkucia@codeweavers.com:
+HRESULT CDECL wined3d_device_map_sub_resource(struct wined3d_device *device,
struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
+{
- struct wined3d_resource *sub_resource;
- TRACE("device %p, resource %p, sub_resource_idx %u, map_desc %p, box %p, flags %#x.\n",
device, resource, sub_resource_idx, map_desc, box, flags);
- if (!(sub_resource = sub_resource_from_resource(resource, sub_resource_idx)))
- {
WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
return E_INVALIDARG;
- }
- return sub_resource->resource_ops->resource_map(sub_resource, map_desc, box, flags);
I don't like the idea of calling the sub resource here. I think this should forward to wined3d_texture_map for textures for now and pass the sub resource index to the resource_map callback.
In the long run we obviously want wined3d_texture_map and wined3d_buffer_map to be merged together, but for now (surface,volume)->(texture) is tricky enough. I have some patches in the works for that.