[PATCH v3 4/4] wined3d: Try to allocate new Vulkan BOs from the client thread for DISCARD maps.

Zebediah Figura zfigura at codeweavers.com
Mon Nov 8 15:09:39 CST 2021


On 11/8/21 1:35 PM, Henri Verbeet wrote:
>>>> +void wined3d_buffer_set_bo(struct wined3d_buffer *buffer, struct wined3d_context *context, struct wined3d_bo *bo)
>>>> +{
>>>> +    TRACE("buffer %p, context %p, bo %p.\n", buffer, context, bo);
>>>> +
>>>> +    buffer->buffer_ops->buffer_set_bo(buffer, context, bo);
>>>> +    buffer->buffer_object = (uintptr_t)bo;
>>>> +    wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
>>>> +    wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
>>>> +}
>>>> +
>>> Is wined3d_buffer_set_bo() the proper place for the
>>> validate/invalidate? Arguably it would be more appropriate to do that
>>> in wined3d_cs_exec_update_sub_resource(). I suppose it mirrors
>>> wined3d_buffer_copy_bo_address().
>>
>> It definitely seems that most validation logic is done within buffer.c,
>> and that makes more sense to me, along the lines of letting that be a
>> buffer-specific implementation detail. I can change it if you feel
>> strongly otherwise, though.
>>
> The issue isn't so much that it's in buffer.c; in principle it would
> be fine to introduce e.g. wined3d_buffer_update_sub_resource()
> containing the implementation of wined3d_cs_exec_update_sub_resource()
> for buffers. The reason that doesn't already exist is mostly just that
> the buffer part of wined3d_cs_exec_update_sub_resource() is fairly
> straightforward. The issue here is more that wined3d_buffer_set_bo()
> seems like something that's conceptually on a lower level than
> sub-resource updates, much like e.g.
> wined3d_resource_prepare_sysmem(),
> wined3d_buffer_vk_create_buffer_object(), or
> wined3d_buffer_gl_create_buffer_object(). I.e., it's not obvious to me
> that replacing a buffer's bo should modify its location flags.

Okay, that makes sense to me. I'll add a 
wined3d_buffer_update_sub_resource() helper.



More information about the wine-devel mailing list