Commit d8e8ab21 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Allow DISCARD maps to be accelerated even on 32-bit architectures.

We will still block on a subsequent NOOVERWRITE map, so in practice this probably doesn't remove any bottlenecks. However, it leads to clearer code, and it matches what will need to be done for textures. Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 01bd9a70
......@@ -1242,7 +1242,7 @@ static bool adapter_vk_alloc_bo(struct wined3d_device *device, struct wined3d_re
if (!bo_vk->b.map_ptr)
{
WARN_(d3d_perf)("BO %p (chunk %p, slab %p) is not persistently mapped.\n",
WARN_(d3d_perf)("BO %p (chunk %p, slab %p) is not mapped.\n",
bo_vk, bo_vk->memory ? bo_vk->memory->chunk : NULL, bo_vk->slab);
if (!wined3d_bo_vk_map(bo_vk, context_vk))
......
......@@ -3073,34 +3073,41 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str
{
/* Limit NOOVERWRITE maps to buffers for now; there are too many ways that
* a texture can be invalidated to even count. */
if (wined3d_map_persistent() && resource->type == WINED3D_RTYPE_BUFFER
&& (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)))
if (resource->type == WINED3D_RTYPE_BUFFER && (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)))
{
struct wined3d_client_resource *client = &resource->client;
struct wined3d_device *device = context->device;
struct wined3d_bo_address addr;
const struct wined3d_bo *bo;
uint8_t *map_ptr;
if (flags & WINED3D_MAP_DISCARD)
{
if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &client->addr))
if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr))
return false;
if (wined3d_map_persistent())
client->addr = addr;
}
else
{
addr = client->addr;
}
bo = client->addr.buffer_object;
bo = addr.buffer_object;
map_ptr = bo ? bo->map_ptr : NULL;
map_ptr += (uintptr_t)client->addr.addr;
map_ptr += (uintptr_t)addr.addr;
if (!map_ptr)
{
TRACE("Sub-resource is not persistently mapped.\n");
TRACE("Sub-resource is not mapped.\n");
return false;
}
wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx,
&map_desc->row_pitch, &map_desc->slice_pitch);
client->mapped_upload.addr = *wined3d_const_bo_address(&client->addr);
client->mapped_upload.addr = *wined3d_const_bo_address(&addr);
client->mapped_upload.flags = 0;
if (bo)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment