On 22 August 2013 00:30, Stefan Dösinger <stefan(a)codeweavers.com> wrote:
> +const char *wined3d_debug_location(DWORD location)
> +{
> + char buf[238];
That number looks a bit arbitrary, although I suppose it's at least
large enough.
> + if (volume->resource.pool == WINED3D_POOL_SYSTEM_MEM
> + || volume->resource.pool == WINED3D_POOL_SCRATCH)
> + {
> + if (location & ~WINED3D_LOCATION_SYSMEM)
> + {
> + ERR("Trying to load a sysmem or scratch volume into %s.\n",
> + wined3d_debug_location(location));
> + return;
> + }
> + }
In principle we have resource_access_from_location() and the
access_flags field in struct wined3d_resource for this. It's only a
warning in surface_load_location() because we load e.g. default pool
surfaces into sysmem for CPU fallbacks, but that doesn't apply to
volumes. The right way for surfaces would probably be to use a staging
resource for CPU fallbacks instead, or something along those lines.
> + if (count_bits(location) > 1)
> + FIXME("Implement loading two locations with one call\n");
> +
I don't think we really want that.
> +static void wined3d_volume_update_location(struct wined3d_volume *volume, DWORD location, BOOL keep)
> +{
> + if (keep)
> + {
> + TRACE("Volume %p, invalidating %s.\n", volume,
> + wined3d_debug_location(volume->locations & ~location));
> + volume->locations = location;
> + }
> + else
> + {
> + TRACE("Volume %p, invalidating %s.\n", volume, wined3d_debug_location(location));
> + volume->locations &= ~location;
> + }
> +}
I'm a bit unhappy with the "persistent" flag to
surface_modify_location(), and this is essentially the same thing. I
think it would be better to just have two separate functions,
wined3d_volume_invalidate_location() and
wined3d_volume_validate_location(). Perhaps
wined3d_volume_update_location() can work too, but in that case I
think it should take two location masks, one to set and one to clear.