On 11/3/21 12:10 PM, Henri Verbeet wrote:
On Wed, 3 Nov 2021 at 00:20, Zebediah Figura zfigura@codeweavers.com wrote:
With the goal of making the context_vk parameter optional, so that we can allocate new BOs from the client thread.
This would mainly be for the wined3d_buffer_vk_create_buffer_object() call in patch 8/8, but in the Vulkan backend, we can always get the context through "device_vk->context_vk", provided we're inside an init_3d()/uninit_3d() pair. I.e., the Vulkan backend can make Vulkan calls from applications threads, it just needs synchronisation. I.e., I don't think the Vulkan backend needs this.
It's true that this patch series is modeled more like the GL backend than it needs to be in general.
I had gotten the impression that we didn't want to touch wined3d_context_vk outside of the CS thread, even though it is thread safe. If that's not the case, all the better, although I'm still more than a little confused about the seemingly arbitrary division between device and context in the Vulkan adapter.
That said, I still think this change is probably the right thing to do, but with a bit of a different justification. We'll likely need a change like this for wined3d_context_gl_create_bo(), and then it makes sense to make wined3d_context_vk_create_bo() a device function as well for consistency.
-static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context_vk, +static bool wined3d_context_vk_create_slab_bo(struct wined3d_device_vk *device_vk, struct wined3d_context_vk *context_vk, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_type, struct wined3d_bo_vk *bo) {
If we're making this a device function, that should probably be called wined3d_device_vk_create_slab_bo(), and be moved to device.c.
-BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDeviceSize size,
VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_type, struct wined3d_bo_vk *bo)
+BOOL wined3d_device_vk_create_bo(struct wined3d_device_vk *device_vk, struct wined3d_context_vk *context_vk,
{VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_type, struct wined3d_bo_vk *bo)
If we're making this a device function, this should be moved to device.c. And if we're touching this, be may as well use the standard "bool" instead of "BOOL".