mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 15:53:37 +00:00
wined3d: Pass map flags to wined3d_context_copy_bo_address().
This is a step towards implementing D3D11_COPY_FLAGS.
This commit is contained in:
parent
2f84616e02
commit
9373cd5e3e
|
@ -4600,9 +4600,9 @@ static void adapter_gl_unmap_bo_address(struct wined3d_context *context,
|
|||
|
||||
static void adapter_gl_copy_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges)
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags)
|
||||
{
|
||||
wined3d_context_gl_copy_bo_address(wined3d_context_gl(context), dst, src, range_count, ranges);
|
||||
wined3d_context_gl_copy_bo_address(wined3d_context_gl(context), dst, src, range_count, ranges, map_flags);
|
||||
}
|
||||
|
||||
static void adapter_gl_flush_bo_address(struct wined3d_context *context,
|
||||
|
|
|
@ -1029,14 +1029,13 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
|
|||
|
||||
void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges)
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags)
|
||||
{
|
||||
struct wined3d_context_vk *context_vk = wined3d_context_vk(context);
|
||||
const struct wined3d_vk_info *vk_info = context_vk->vk_info;
|
||||
struct wined3d_bo_vk staging_bo, *src_bo, *dst_bo;
|
||||
VkAccessFlags src_access_mask, dst_access_mask;
|
||||
VkBufferMemoryBarrier vk_barrier[2];
|
||||
DWORD map_flags = WINED3D_MAP_WRITE;
|
||||
const struct wined3d_range *range;
|
||||
struct wined3d_bo_address staging;
|
||||
VkCommandBuffer vk_command_buffer;
|
||||
|
@ -1048,9 +1047,6 @@ void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
|||
src_bo = src->buffer_object ? wined3d_bo_vk(src->buffer_object) : NULL;
|
||||
dst_bo = dst->buffer_object ? wined3d_bo_vk(dst->buffer_object) : NULL;
|
||||
|
||||
if (dst_bo && !dst->addr && !ranges->offset && ranges->size == dst_bo->size)
|
||||
map_flags |= WINED3D_MAP_DISCARD;
|
||||
|
||||
if (src_bo && dst_bo)
|
||||
{
|
||||
if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
|
||||
|
@ -1131,8 +1127,8 @@ void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
|||
|
||||
staging.buffer_object = &staging_bo.b;
|
||||
staging.addr = NULL;
|
||||
adapter_vk_copy_bo_address(context, &staging, src, range_count, ranges);
|
||||
adapter_vk_copy_bo_address(context, dst, &staging, range_count, ranges);
|
||||
adapter_vk_copy_bo_address(context, &staging, src, range_count, ranges, WINED3D_MAP_WRITE);
|
||||
adapter_vk_copy_bo_address(context, dst, &staging, range_count, ranges, WINED3D_MAP_WRITE);
|
||||
|
||||
wined3d_context_vk_destroy_bo(context_vk, &staging_bo);
|
||||
|
||||
|
@ -1151,8 +1147,8 @@ void adapter_vk_copy_bo_address(struct wined3d_context *context,
|
|||
|
||||
staging.buffer_object = &staging_bo.b;
|
||||
staging.addr = NULL;
|
||||
adapter_vk_copy_bo_address(context, &staging, src, range_count, ranges);
|
||||
adapter_vk_copy_bo_address(context, dst, &staging, range_count, ranges);
|
||||
adapter_vk_copy_bo_address(context, &staging, src, range_count, ranges, WINED3D_MAP_WRITE);
|
||||
adapter_vk_copy_bo_address(context, dst, &staging, range_count, ranges, WINED3D_MAP_WRITE);
|
||||
|
||||
wined3d_context_vk_destroy_bo(context_vk, &staging_bo);
|
||||
|
||||
|
|
|
@ -562,7 +562,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
|
|||
dst.addr = NULL;
|
||||
src.buffer_object = NULL;
|
||||
src.addr = data;
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, buffer->modified_areas, buffer->maps);
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, buffer->modified_areas, buffer->maps, WINED3D_MAP_WRITE);
|
||||
|
||||
heap_free(data);
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
|
|||
src.addr = NULL;
|
||||
range.offset = 0;
|
||||
range.size = buffer->resource.size;
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, 1, &range);
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, 1, &range, WINED3D_MAP_WRITE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -648,9 +648,19 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
|
|||
src.addr = buffer->resource.heap_memory;
|
||||
|
||||
if (!buffer->conversion_map)
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, buffer->modified_areas, buffer->maps);
|
||||
{
|
||||
uint32_t map_flags = WINED3D_MAP_WRITE;
|
||||
|
||||
if (buffer->modified_areas == 1 && !buffer->maps[0].offset
|
||||
&& buffer->maps[0].size == buffer->resource.size)
|
||||
map_flags |= WINED3D_MAP_DISCARD;
|
||||
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, buffer->modified_areas, buffer->maps, map_flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_conversion_upload(buffer, context);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1134,16 +1144,20 @@ static void wined3d_buffer_set_bo(struct wined3d_buffer *buffer, struct wined3d_
|
|||
void wined3d_buffer_copy_bo_address(struct wined3d_buffer *dst_buffer, struct wined3d_context *context,
|
||||
unsigned int dst_offset, const struct wined3d_const_bo_address *src_addr, unsigned int size)
|
||||
{
|
||||
uint32_t map_flags = WINED3D_MAP_WRITE;
|
||||
struct wined3d_bo_address dst_addr;
|
||||
struct wined3d_range range;
|
||||
DWORD dst_location;
|
||||
|
||||
if (!dst_offset && size == dst_buffer->resource.size)
|
||||
map_flags |= WINED3D_MAP_DISCARD;
|
||||
|
||||
dst_location = wined3d_buffer_get_memory(dst_buffer, context, &dst_addr);
|
||||
dst_addr.addr += dst_offset;
|
||||
|
||||
range.offset = 0;
|
||||
range.size = size;
|
||||
wined3d_context_copy_bo_address(context, &dst_addr, (const struct wined3d_bo_address *)src_addr, 1, &range);
|
||||
wined3d_context_copy_bo_address(context, &dst_addr, (const struct wined3d_bo_address *)src_addr, 1, &range, map_flags);
|
||||
wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -3067,9 +3067,8 @@ void wined3d_context_gl_flush_bo_address(struct wined3d_context_gl *context_gl,
|
|||
|
||||
void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges)
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags)
|
||||
{
|
||||
uint32_t map_flags = WINED3D_MAP_WRITE;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_bo_gl *src_bo, *dst_bo;
|
||||
BYTE *dst_ptr, *src_ptr;
|
||||
|
@ -3079,9 +3078,6 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
|
|||
src_bo = src->buffer_object ? wined3d_bo_gl(src->buffer_object) : NULL;
|
||||
dst_bo = dst->buffer_object ? wined3d_bo_gl(dst->buffer_object) : NULL;
|
||||
|
||||
if (dst_bo && !dst->addr && !ranges->offset && ranges->size == dst_bo->size)
|
||||
map_flags |= WINED3D_MAP_DISCARD;
|
||||
|
||||
if (dst_bo && src_bo)
|
||||
{
|
||||
if (gl_info->supported[ARB_COPY_BUFFER])
|
||||
|
|
|
@ -2981,7 +2981,7 @@ static void adapter_no3d_unmap_bo_address(struct wined3d_context *context,
|
|||
|
||||
static void adapter_no3d_copy_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges)
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
|
|
@ -867,7 +867,8 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture,
|
|||
{
|
||||
wined3d_texture_get_bo_address(texture, sub_resource_idx,
|
||||
&source, (current & wined3d_texture_sysmem_locations));
|
||||
wined3d_context_copy_bo_address(context, &destination, &source, 1, &range);
|
||||
wined3d_context_copy_bo_address(context, &destination, &source, 1, &range,
|
||||
WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD);
|
||||
}
|
||||
ret = TRUE;
|
||||
}
|
||||
|
|
|
@ -1689,7 +1689,7 @@ void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_v
|
|||
|
||||
range.offset = 0;
|
||||
range.size = sizeof(value);
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, 1, &range);
|
||||
wined3d_context_copy_bo_address(context, &dst, &src, 1, &range, WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD);
|
||||
|
||||
context_release(context);
|
||||
}
|
||||
|
@ -2175,7 +2175,8 @@ void wined3d_unordered_access_view_vk_clear(struct wined3d_unordered_access_view
|
|||
|
||||
range.offset = 0;
|
||||
range.size = sizeof(constants);
|
||||
adapter_vk_copy_bo_address(&context_vk->c, &cb_destination_address, &cb_source_address, 1, &range);
|
||||
adapter_vk_copy_bo_address(&context_vk->c, &cb_destination_address,
|
||||
&cb_source_address, 1, &range, WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD);
|
||||
|
||||
buffer_info.buffer = constants_bo.vk_buffer;
|
||||
buffer_info.range = constants_bo.size;
|
||||
|
|
|
@ -2275,7 +2275,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl,
|
|||
void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl *context_gl, GLenum target) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges) DECLSPEC_HIDDEN;
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_destroy_bo(struct wined3d_context_gl *context_gl, struct wined3d_bo_gl *bo) DECLSPEC_HIDDEN;
|
||||
void wined3d_context_gl_draw_shaded_quad(struct wined3d_context_gl *context_gl, struct wined3d_texture_gl *texture_gl,
|
||||
|
@ -2910,7 +2910,7 @@ struct wined3d_adapter_ops
|
|||
unsigned int range_count, const struct wined3d_range *ranges);
|
||||
void (*adapter_copy_bo_address)(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges);
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags);
|
||||
void (*adapter_flush_bo_address)(struct wined3d_context *context,
|
||||
const struct wined3d_const_bo_address *data, size_t size);
|
||||
bool (*adapter_alloc_bo)(struct wined3d_device *device, struct wined3d_resource *resource,
|
||||
|
@ -5622,9 +5622,9 @@ static inline void wined3d_context_unmap_bo_address(struct wined3d_context *cont
|
|||
|
||||
static inline void wined3d_context_copy_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *dst, const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges)
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags)
|
||||
{
|
||||
context->device->adapter->adapter_ops->adapter_copy_bo_address(context, dst, src, range_count, ranges);
|
||||
context->device->adapter->adapter_ops->adapter_copy_bo_address(context, dst, src, range_count, ranges, map_flags);
|
||||
}
|
||||
|
||||
static inline void wined3d_context_flush_bo_address(struct wined3d_context *context,
|
||||
|
|
|
@ -704,7 +704,7 @@ static inline struct wined3d_adapter_vk *wined3d_adapter_vk(struct wined3d_adapt
|
|||
|
||||
void adapter_vk_copy_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *dst,
|
||||
const struct wined3d_bo_address *src,
|
||||
unsigned int range_count, const struct wined3d_range *ranges) DECLSPEC_HIDDEN;
|
||||
unsigned int range_count, const struct wined3d_range *ranges, uint32_t map_flags) DECLSPEC_HIDDEN;
|
||||
unsigned int wined3d_adapter_vk_get_memory_type_index(const struct wined3d_adapter_vk *adapter_vk,
|
||||
uint32_t memory_type_mask, VkMemoryPropertyFlags flags) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_adapter_vk_init_format_info(struct wined3d_adapter_vk *adapter_vk,
|
||||
|
|
Loading…
Reference in a new issue