On Thu, 7 Oct 2021 at 04:04, Zebediah Figura zfigura@codeweavers.com wrote:
Partially undoes 61024aa12f.
We want to be able to allocate a new upload BO for a given map, but it's a bit structurally awkward to ask for a specific memory layout when parepare_upload_bo() might return different ones depending on the flags and other factors.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
This is kind of janky, though. It might not be all that unreasonable to ask prepare_upload_bo() for a specific layout.
Right; it's not spelled out above, but the issue is that in some cases we may want to return an existing allocation, in which case we wouldn't have control over its layout. The options are essentially to either ignore the requested layout in those cases, or to simply always let map_upload_bo() pick an appropriate layout. This patch (in combination with the following in the series) effectively does the latter. I suppose the question is, are there ever cases where we'd need a different layout than would be returned by map_upload_bo() by default?
In terms of the commit message, note that prepare_upload_bo() no longer exists; that's map_upload_bo() now.
While reviewing this patch, I noticed the wined3d_not_from_cs() call is below the map_upload_bo() block now; that seems undesirable.
@@ -2519,6 +2524,12 @@ HRESULT wined3d_device_context_emit_map(struct wined3d_device_context *context, wined3d_device_context_submit(context, WINED3D_CS_QUEUE_MAP); wined3d_device_context_finish(context, WINED3D_CS_QUEUE_MAP);
- if (SUCCEEDED(hr))
- {
map_desc->data = map_ptr;
map_desc->row_pitch = row_pitch;
map_desc->slice_pitch = slice_pitch;
- } return hr;
}
We might as well return on failure, and save some indentation.