mem->map = map;
mem->map_size = map_size;
+ mem->map_delta = (offset - map_offset);
- *ppData = mem->map + (offset - map_offset);
+ *ppData = mem->map + mem->map_delta;
return VK_SUCCESS;
}
mem->map = NULL;
mem->map_size = 0;
+ mem->map_delta = 0;
}
static void
{
for (uint32_t i = 0; i < count; i++) {
ANV_FROM_HANDLE(anv_device_memory, mem, ranges[i].memory);
- if (ranges[i].offset >= mem->map_size)
+ uint64_t map_offset = ranges[i].offset + mem->map_delta;
+ if (map_offset >= mem->map_size)
continue;
if (mem->type->propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
continue;
- intel_clflush_range(mem->map + ranges[i].offset,
- MIN2(ranges[i].size, mem->map_size - ranges[i].offset));
+ intel_clflush_range(mem->map + map_offset,
+ MIN2(ranges[i].size, mem->map_size - map_offset));
}
}
VkDeviceSize map_size;
void * map;
+ /* The map, from the user PoV is map + map_delta */
+ uint32_t map_delta;
+
/* If set, we are holding reference to AHardwareBuffer
* which we must release when memory is freed.
*/