wined3d: Make the "buffer_object" field of struct wined3d_const_bo_addr a wined3d_bo pointer.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-11-15 16:30:18 -06:00 committed by Alexandre Julliard
parent 7148f3939a
commit f3647c4b4f
7 changed files with 17 additions and 12 deletions

View File

@ -1211,12 +1211,12 @@ static void adapter_vk_flush_bo_address(struct wined3d_context *context,
const struct wined3d_const_bo_address *data, size_t size)
{
struct wined3d_context_vk *context_vk = wined3d_context_vk(context);
struct wined3d_bo_vk *bo;
struct wined3d_bo *bo;
if (!(bo = (struct wined3d_bo_vk *)data->buffer_object))
if (!(bo = data->buffer_object))
return;
flush_bo_range(context_vk, bo, (uintptr_t)data->addr, size);
flush_bo_range(context_vk, wined3d_bo_vk(bo), (uintptr_t)data->addr, size);
}
static bool adapter_vk_alloc_bo(struct wined3d_device *device, struct wined3d_resource *resource,

View File

@ -1132,12 +1132,12 @@ void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wi
{
if (upload_bo->flags & UPLOAD_BO_RENAME_ON_UNMAP)
{
wined3d_buffer_set_bo(buffer, context, (struct wined3d_bo *)upload_bo->addr.buffer_object);
wined3d_buffer_set_bo(buffer, context, upload_bo->addr.buffer_object);
wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
}
if (upload_bo->addr.buffer_object && upload_bo->addr.buffer_object == (uintptr_t)buffer->buffer_object)
if (upload_bo->addr.buffer_object && upload_bo->addr.buffer_object == buffer->buffer_object)
wined3d_context_flush_bo_address(context, &upload_bo->addr, size);
else
wined3d_buffer_copy_bo_address(buffer, context, offset, &upload_bo->addr, size);

View File

@ -2748,8 +2748,9 @@ static void flush_bo_ranges(struct wined3d_context_gl *context_gl, const struct
struct wined3d_bo_gl *bo;
unsigned int i;
if (!(bo = (struct wined3d_bo_gl *)data->buffer_object) || bo->b.coherent)
if (!data->buffer_object || data->buffer_object->coherent)
return;
bo = wined3d_bo_gl(data->buffer_object);
gl_info = context_gl->gl_info;
wined3d_context_gl_bind_bo(context_gl, bo->binding, bo->id);

View File

@ -2476,7 +2476,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
return;
}
bo.buffer_object = (struct wined3d_bo *)src_bo_addr->buffer_object;
bo.buffer_object = src_bo_addr->buffer_object;
bo.addr = (BYTE *)src_bo_addr->addr + src_box->front * src_slice_pitch;
if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
{
@ -4720,7 +4720,7 @@ static void wined3d_texture_vk_upload_data(struct wined3d_context *context,
/* We need to be outside of a render pass for vkCmdPipelineBarrier() and vkCmdCopyBufferToImage() calls below. */
wined3d_context_vk_end_current_render_pass(context_vk);
if (!(src_bo = (struct wined3d_bo_vk *)src_bo_addr->buffer_object))
if (!src_bo_addr->buffer_object)
{
if (!wined3d_context_vk_create_bo(context_vk, sub_resource->size,
VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo))
@ -4755,6 +4755,8 @@ static void wined3d_texture_vk_upload_data(struct wined3d_context *context,
}
else
{
src_bo = wined3d_bo_vk(src_bo_addr->buffer_object);
vk_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
vk_barrier.pNext = NULL;
vk_barrier.srcAccessMask = vk_access_mask_from_buffer_usage(src_bo->usage) & ~WINED3D_READ_ONLY_ACCESS_FLAGS;
@ -4917,7 +4919,7 @@ static void wined3d_texture_vk_download_data(struct wined3d_context *context,
/* We need to be outside of a render pass for vkCmdPipelineBarrier() and vkCmdCopyBufferToImage() calls below. */
wined3d_context_vk_end_current_render_pass(context_vk);
if (!(dst_bo = (struct wined3d_bo_vk *)dst_bo_addr->buffer_object))
if (!dst_bo_addr->buffer_object)
{
if (!wined3d_context_vk_create_bo(context_vk, sub_resource->size,
VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &staging_bo))
@ -4930,6 +4932,8 @@ static void wined3d_texture_vk_download_data(struct wined3d_context *context,
}
else
{
dst_bo = wined3d_bo_vk(dst_bo_addr->buffer_object);
vk_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
vk_barrier.pNext = NULL;
vk_barrier.srcAccessMask = vk_access_mask_from_buffer_usage(dst_bo->usage);

View File

@ -4613,7 +4613,7 @@ const char *debug_const_bo_address(const struct wined3d_const_bo_address *addres
{
if (!address)
return "(null)";
return wine_dbg_sprintf("{%#lx:%p}", address->buffer_object, address->addr);
return wine_dbg_sprintf("{%p:%p}", address->buffer_object, address->addr);
}
const char *debug_bo_address(const struct wined3d_bo_address *address)

View File

@ -1632,7 +1632,7 @@ void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_
if (!view->counter_bo)
return;
src.buffer_object = view->counter_bo;
src.buffer_object = (struct wined3d_bo *)view->counter_bo;
src.addr = NULL;
wined3d_buffer_copy_bo_address(buffer, context, offset, &src, sizeof(uint32_t));

View File

@ -1685,7 +1685,7 @@ struct wined3d_bo_address
struct wined3d_const_bo_address
{
UINT_PTR buffer_object;
struct wined3d_bo *buffer_object;
const BYTE *addr;
};