[PATCH 3/3] wined3d: Do not emit an upload for NOOVERWRITE maps on deferred contexts.

Henri Verbeet hverbeet at gmail.com
Wed Sep 29 10:48:18 CDT 2021


On Tue, 28 Sept 2021 at 23:28, Zebediah Figura <zfigura at codeweavers.com> wrote:
> @@ -2749,6 +2751,7 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte
>      op->box = *box;
>      op->bo.addr.buffer_object = 0;
>      op->bo.addr.addr = data;
> +    op->bo.flags = UPLOAD_BO_UPLOAD_ON_UNMAP;
>      op->row_pitch = row_pitch;
>      op->slice_pitch = slice_pitch;
>
Do we need UPLOAD_BO_UPLOAD_ON_UNMAP here? It seems a little out of
place, and wined3d_cs_exec_update_sub_resource() doesn't appear to use
it.

> @@ -3519,13 +3522,13 @@ static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_co
>
>      if (flags & WINED3D_MAP_NOOVERWRITE)
>      {
> -        const struct wined3d_deferred_upload *upload;
> -
>          if ((upload = deferred_context_get_upload(deferred, resource, sub_resource_idx)))
>          {
> +            upload->map_flags = flags;
>              map_ptr = (uint8_t *)align((size_t)upload->sysmem, RESOURCE_ALIGNMENT);
>              bo->addr.buffer_object = 0;
>              bo->addr.addr = map_ptr;
> +            bo->flags = 0;
>              return map_ptr;
>          }
>
> @@ -3540,6 +3543,7 @@ static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_co
>          return NULL;
>
>      upload = &deferred->uploads[deferred->upload_count++];
> +    upload->map_flags = flags;
>      upload->resource = resource;
>      wined3d_resource_incref(resource);
>      upload->sub_resource_idx = sub_resource_idx;
> @@ -3549,6 +3553,7 @@ static void *wined3d_deferred_context_prepare_upload_bo(struct wined3d_device_co
>      bo->addr.buffer_object = 0;
>      map_ptr = (uint8_t *)align((size_t)sysmem, RESOURCE_ALIGNMENT);
>      bo->addr.addr = map_ptr;
> +    bo->flags = UPLOAD_BO_UPLOAD_ON_UNMAP;
>      return map_ptr;
>  }
>
> @@ -3563,6 +3568,9 @@ static bool wined3d_deferred_context_get_upload_bo(struct wined3d_device_context
>          *box = upload->box;
>          bo->addr.buffer_object = 0;
>          bo->addr.addr = (uint8_t *)align((size_t)upload->sysmem, RESOURCE_ALIGNMENT);
> +        bo->flags = 0;
> +        if (!(upload->map_flags & WINED3D_MAP_NOOVERWRITE))
> +            bo->flags |= UPLOAD_BO_UPLOAD_ON_UNMAP;
>          return true;
>      }
>
In some ways, it would seem nicer to store the UPLOAD_BO flags
directly in the wined3d_deferred_upload structure, instead of deriving
them from the stored map flags. Perhaps there are other reasons to
store the map flags in subsequent patches though?



More information about the wine-devel mailing list